[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201027203041.GS2628@hirez.programming.kicks-ass.net>
Date: Tue, 27 Oct 2020 21:30:41 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: David Woodhouse <dwmw2@...radead.org>
Cc: linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org,
Oleg Nesterov <oleg@...hat.com>
Subject: Re: [PATCH v2 1/2] sched/wait: Add add_wait_queue_priority()
On Tue, Oct 27, 2020 at 07:27:59PM +0000, David Woodhouse wrote:
> > While looking at this I found that weird __add_wait_queue_exclusive()
> > which is used by fs/eventpoll.c and does something similar, except it
> > doesn't keep the FIFO order.
>
> It does, doesn't it? Except those so-called "exclusive" entries end up
> in FIFO order amongst themselves at the *tail* of the queue, to be
> woken up only after all the other entries before them *haven't* been
> excluded.
__add_wait_queue_exclusive() uses __add_wait_queue() which does
list_add(). It does _not_ add at the tail like normal exclusive users,
and there is exactly _1_ user in tree that does this.
I'm not exactly sure how this happened, but:
add_wait_queue_exclusive()
and
__add_wait_queue_exclusive()
are not related :-(
> > The Changelog doesn't state how important this property is to you.
>
> Because it isn't :)
>
> The ordering is:
>
> { PRIORITY }* { NON-EXCLUSIVE }* { EXCLUSIVE(sic) }*
>
> I care that PRIORITY comes before the others, because I want to
> actually exclude the others. Especially the "non-exclusive" ones, which
> the 'exclusive' ones don't actually exclude.
>
> I absolutely don't care about ordering *within* the set of PRIORITY
> entries, since as I said I expect there to be only one.
Then you could arguably do something like:
spin_lock_irqsave(&wq_head->lock, flags);
__add_wait_queue_exclusive(wq_head, wq_entry);
spin_unlock_irqrestore(&wq_head->lock, flags);
and leave it at that.
But now I'm itching to fix that horrible naming... tomorrow perhaps.
Powered by blists - more mailing lists