linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Hugo Lefeuvre <hle@owl.eu.com>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	devel@driverdev.osuosl.org, "Todd Kjos" <tkjos@android.com>,
	"Greg Hartman" <ghartman@google.com>,
	"Alistair Strachan" <astrachan@google.com>,
	linux-kernel@vger.kernel.org, "Arve Hjønnevåg" <arve@android.com>,
	"Joel Fernandes" <joel@joelfernandes.org>,
	"Martijn Coenen" <maco@android.com>,
	"Christian Brauner" <christian@brauner.io>
Subject: Re: [PATCH] staging/android: use multiple futex wait queues
Date: Fri, 15 Feb 2019 10:06:14 +0300	[thread overview]
Message-ID: <20190215070614.GC2326@kadam> (raw)
In-Reply-To: <20190214173459.GA10737@behemoth.owl.eu.com.local>

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

  parent reply	other threads:[~2019-02-15  7:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-14 17:34 [PATCH] staging/android: use multiple futex wait queues Hugo Lefeuvre
2019-02-14 17:50 ` Greg Kroah-Hartman
2019-02-14 21:28   ` Hugo Lefeuvre
2019-02-16 20:46   ` Hugo Lefeuvre
2019-02-15  7:06 ` Dan Carpenter [this message]
2019-02-15  7:54   ` Hugo Lefeuvre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190215070614.GC2326@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=arve@android.com \
    --cc=astrachan@google.com \
    --cc=christian@brauner.io \
    --cc=devel@driverdev.osuosl.org \
    --cc=ghartman@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hle@owl.eu.com \
    --cc=joel@joelfernandes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maco@android.com \
    --cc=tkjos@android.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).