From: Oleg Nesterov <oleg@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Peng Tao <bergwolf@gmail.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@redhat.com>,
Oleg Drokin <oleg.drokin@intel.com>,
Andreas Dilger <andreas.dilger@intel.com>
Subject: Re: [PATCH RFC] sched: introduce add_wait_queue_exclusive_head
Date: Wed, 19 Mar 2014 18:19:06 +0100 [thread overview]
Message-ID: <20140319171906.GA11377@redhat.com> (raw)
In-Reply-To: <20140319165747.GC8557@laptop.programming.kicks-ass.net>
On 03/19, Peter Zijlstra wrote:
>
> On Wed, Mar 19, 2014 at 05:49:07PM +0100, Oleg Nesterov wrote:
> > +static void add_wait_queue_flag(wait_queue_head_t *q, wait_queue_t *wait)
> > +{
> > + struct list_head *head = &q->task_list;
> > + wait_queue_t *excl;
> > +
> > + if (wait->flags & WQ_FLAG_EXCLUSIVE) {
> > + if (wait->flags & WQ_FLAG_EXCLUSIVE_HEAD) {
> > + list_for_each_entry(excl, head, task_list)
> > + if (excl->flags & WQ_FLAG_EXCLUSIVE) {
> > + head = &excl->task_list;
> > + break;
> > + }
>
> I prefer an extra pair of { } here,
OK,
> but the main concern would be the
> cost of that iteration.
Yes.
This change assumes that we do not mix exclusive and !exclusive, in
this case list_for_each_entry() is cheap, the list is either empty
or the first entry is WQ_FLAG_EXCLUSIVE.
Otherwise the user should blame itself, but the code still will work
correctly.
Or we can do
if (WQ_FLAG_EXCLUSIVE_HEAD) {
WARN_ON(!list_empty(head) &&
(list_first_entry(...)-flags & WQ_FLAG_EXCLUSIVE));
...
}
> Other than that, yes something like that would do I suppose.
OK, I'll try to test/cleanup/resend tomorrow.
Oleg.
next prev parent reply other threads:[~2014-03-19 17:20 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-18 13:10 [PATCH RFC] sched: introduce add_wait_queue_exclusive_head Peng Tao
2014-03-18 13:33 ` Peter Zijlstra
2014-03-18 13:51 ` Peng Tao
2014-03-18 14:05 ` Peter Zijlstra
2014-03-18 14:44 ` Peng Tao
2014-03-18 16:23 ` Oleg Nesterov
2014-03-19 2:22 ` Peng Tao
2014-03-19 17:33 ` Oleg Nesterov
2014-03-19 19:44 ` Dilger, Andreas
2014-03-19 19:55 ` Peter Zijlstra
2014-03-20 7:06 ` Dilger, Andreas
2014-03-20 18:49 ` Oleg Nesterov
2014-03-18 15:47 ` Oleg Nesterov
2014-03-19 2:17 ` Peng Tao
[not found] ` <20140319164907.GA10113@redhat.com>
2014-03-19 16:57 ` Peter Zijlstra
2014-03-19 17:19 ` Oleg Nesterov [this message]
2014-03-20 17:51 ` [PATCH 0/2] wait: introduce WQ_FLAG_EXCLUSIVE_HEAD Oleg Nesterov
2014-03-20 17:51 ` [PATCH 1/2] wait: turn "bool exclusive" arg of __wait_event() into wflags Oleg Nesterov
2014-03-20 17:51 ` [PATCH 2/2] wait: introduce WQ_FLAG_EXCLUSIVE_HEAD Oleg Nesterov
2014-03-21 2:45 ` [PATCH 0/2] " Dilger, Andreas
2014-03-21 18:49 ` Oleg Nesterov
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=20140319171906.GA11377@redhat.com \
--to=oleg@redhat.com \
--cc=andreas.dilger@intel.com \
--cc=bergwolf@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=oleg.drokin@intel.com \
--cc=peterz@infradead.org \
/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