[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171222080841.22kptq7gzmvswfvk@hirez.programming.kicks-ass.net>
Date: Fri, 22 Dec 2017 09:08:41 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: NeilBrown <neilb@...e.com>
Cc: Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
lustre <lustre-devel@...ts.lustre.org>
Subject: Re: [PATCH 2/2] sched/wait: add wait_event_idle_exclusive_lifo()
On Fri, Dec 22, 2017 at 02:11:04PM +1100, NeilBrown wrote:
> wait_event_*_exclusive() adds new waiters to the end of the
> quest, while non-exclusive wait_event adds to the head.
>
> This ensures that a wake_up will wake all non-exclusive
> waiters and at most one exclusive wait, but it means that
> exclusive waiters are woken in a FIFO order, so the task
> woken is the one least likely to have data in the CPU cache.
>
> When simple interaction with non-exclusive waiters is not
> important, and when choosing a cache-hot task is, the new
>
> wait_event_idle_exclusive_lifo()
> and
> wait_event_idle_exclusive_lifo_timeout()
>
> can be used. To implement these we introduce a new
> WQ_FLAG_LIFO which causes prepare_to_wait_event() to
> add to the head of the queue.
>
> This will be used to allow lustre's l_wait_event() to be
> replaced with more standard wait.h macros.
Urgh, so the problem with lifo is that it tends to generate starvation
so you have to be very careful with how one uses it.
Is there really a measurable difference if you make lustre use the
regular fifo stuff?
> Signed-off-by: NeilBrown <neilb@...e.com>
> ---
> include/linux/wait.h | 95 +++++++++++++++++++++++++++++++++++++++++++++++---
> kernel/sched/wait.c | 3 +-
> 2 files changed, 91 insertions(+), 7 deletions(-)
>
> diff --git a/include/linux/wait.h b/include/linux/wait.h
> index 3aea0780c9d0..49cb393c53d5 100644
> --- a/include/linux/wait.h
> +++ b/include/linux/wait.h
> @@ -20,6 +20,9 @@ int default_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int
> #define WQ_FLAG_EXCLUSIVE 0x01
> #define WQ_FLAG_WOKEN 0x02
> #define WQ_FLAG_BOOKMARK 0x04
> +#define WQ_FLAG_LIFO 0x08 /* used with WQ_FLAG_EXCLUSIVE to force
> + * LIFO scheduling in prepare_to_wait_event().
> + */
This is not an acceptable comment style.
Powered by blists - more mailing lists