From: Joel Fernandes <joel@joelfernandes.org>
To: Hugo Lefeuvre <hle@owl.eu.com>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Greg Hartman" <ghartman@google.com>,
"Alistair Strachan" <strachan@google.com>,
"Arve Hjønnevåg" <arve@android.com>,
"Todd Kjos" <tkjos@android.com>,
"Martijn Coenen" <maco@android.com>,
"Christian Brauner" <christian@brauner.io>,
"Ingo Molnar" <mingo@redhat.com>,
"Peter Zijlstra" <peterz@infradead.org>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] sched/wait: use freezable_schedule when possible
Date: Tue, 5 Feb 2019 11:37:39 -0500 [thread overview]
Message-ID: <20190205163739.GD46829@google.com> (raw)
In-Reply-To: <d9b2ed186ed6fcacaaecd876bb66dca8fa329d8b.1548998323.git.hle@owl.eu.com>
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@joelfernandes.org>
thanks,
- Joel
>
> Signed-off-by: Hugo Lefeuvre <hle@owl.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
next prev parent reply other threads:[~2019-02-05 16:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-01 5:37 [PATCH 0/3] sched/wait, staging/android: simplification and optimization of freeze related code Hugo Lefeuvre
2019-02-01 5:38 ` [PATCH 1/3] sched/wait: use freezable_schedule when possible Hugo Lefeuvre
2019-02-02 18:37 ` Joel Fernandes
2019-02-06 23:30 ` Hugo Lefeuvre
2019-02-07 15:05 ` Joel Fernandes
2019-02-07 21:40 ` Hugo Lefeuvre
2019-02-07 13:28 ` Hugo Lefeuvre
2019-02-05 16:37 ` Joel Fernandes [this message]
2019-02-01 5:38 ` [PATCH 2/3] sched/wait: introduce wait_event_freezable_hrtimeout Hugo Lefeuvre
2019-02-05 16:42 ` Joel Fernandes
2019-02-01 5:39 ` [PATCH 3/3] staging/android: simplify handle_vsoc_cond_wait Hugo Lefeuvre
2019-02-04 15:52 ` Joel Fernandes
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=20190205163739.GD46829@google.com \
--to=joel@joelfernandes.org \
--cc=arve@android.com \
--cc=christian@brauner.io \
--cc=devel@driverdev.osuosl.org \
--cc=ghartman@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=hle@owl.eu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maco@android.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=strachan@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.