lkml.org 
[lkml]   [2019]   [Feb]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] staging/android: use multiple futex wait queues
On Thu, Feb 14, 2019 at 06:34:59PM +0100, Hugo Lefeuvre wrote:
> @@ -402,6 +410,7 @@ static int handle_vsoc_cond_wait(struct file *filp, struct vsoc_cond_wait *arg)
> struct vsoc_region_data *data = vsoc_dev.regions_data + region_number;
> int ret = 0;
> struct vsoc_device_region *region_p = vsoc_region_from_filep(filp);
> + struct vsoc_futex_wait_queue_t *it, *wait_queue = NULL;
^^^^^^^^^^^^^^^^^
> atomic_t *address = NULL;
> ktime_t wake_time;
>
> @@ -415,10 +424,27 @@ static int handle_vsoc_cond_wait(struct file *filp, struct vsoc_cond_wait *arg)
> address = shm_off_to_virtual_addr(region_p->region_begin_offset +
> arg->offset);
>
> + /* Find wait queue corresponding to offset or create it */
> + spin_lock(&data->futex_wait_queue_lock);
> + list_for_each_entry(it, &data->futex_wait_queue_list, list) {
> + if (wait_queue->offset == arg->offset) {
^^^^^^^^^^^^^^^^^^
You meant "it->offset".


> + wait_queue = it;
> + break;
> + }
> + }
> +
> + if (!wait_queue) {
> + wait_queue = kmalloc(sizeof(*wait_queue), GFP_KERNEL);
> + wait_queue->offset = arg->offset;
> + init_waitqueue_head(&wait_queue->queue);
> + list_add(&wait_queue->list, &data->futex_wait_queue_list);
> + }
> + spin_unlock(&data->futex_wait_queue_lock);

regards,
dan carpenter

\
 
 \ /
  Last update: 2019-02-15 08:07    [W:0.055 / U:10.000 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site