[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190205163739.GD46829@google.com>
Date: Tue, 5 Feb 2019 11:37:39 -0500
From: Joel Fernandes <joel@...lfernandes.org>
To: Hugo Lefeuvre <hle@....eu.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Greg Hartman <ghartman@...gle.com>,
Alistair Strachan <strachan@...gle.com>,
Arve Hjønnevåg <arve@...roid.com>,
Todd Kjos <tkjos@...roid.com>,
Martijn Coenen <maco@...roid.com>,
Christian Brauner <christian@...uner.io>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] sched/wait: use freezable_schedule when possible
On Fri, Feb 01, 2019 at 06:38:05AM +0100, Hugo Lefeuvre wrote:
> Replace schedule(); try_to_freeze() by freezable_schedule().
>
> Tasks calling freezable_schedule() set the PF_FREEZER_SKIP flag
> before calling schedule(). Unlike tasks calling schedule();
> try_to_freeze() tasks calling freezable_schedule() are not awaken by
> try_to_freeze_tasks(). Instead they call try_to_freeze() when they
> wake up if the freeze is still underway.
>
> It is not a problem since sleeping tasks can't do anything which isn't
> allowed for a frozen task while sleeping.
>
> The result is a potential performance gain during freeze, since less
> tasks have to be awaken.
Reviewed-by: Joel Fernandes (Google) <joel@...lfernandes.org>
thanks,
- Joel
>
> Signed-off-by: Hugo Lefeuvre <hle@....eu.com>
> ---
> include/linux/wait.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/wait.h b/include/linux/wait.h
> index ed7c122cb31f..5f3efabc36f4 100644
> --- a/include/linux/wait.h
> +++ b/include/linux/wait.h
> @@ -308,7 +308,7 @@ do { \
>
> #define __wait_event_freezable(wq_head, condition) \
> ___wait_event(wq_head, condition, TASK_INTERRUPTIBLE, 0, 0, \
> - schedule(); try_to_freeze())
> + freezable_schedule())
>
> /**
> * wait_event_freezable - sleep (or freeze) until a condition gets true
> @@ -367,7 +367,7 @@ do { \
> #define __wait_event_freezable_timeout(wq_head, condition, timeout) \
> ___wait_event(wq_head, ___wait_cond_timeout(condition), \
> TASK_INTERRUPTIBLE, 0, timeout, \
> - __ret = schedule_timeout(__ret); try_to_freeze())
> + __ret = freezable_schedule_timeout(__ret))
>
> /*
> * like wait_event_timeout() -- except it uses TASK_INTERRUPTIBLE to avoid
> @@ -588,7 +588,7 @@ do { \
>
> #define __wait_event_freezable_exclusive(wq, condition) \
> ___wait_event(wq, condition, TASK_INTERRUPTIBLE, 1, 0, \
> - schedule(); try_to_freeze())
> + freezable_schedule())
>
> #define wait_event_freezable_exclusive(wq, condition) \
> ({ \
> --
> 2.20.1
Powered by blists - more mailing lists