From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu, dipankar@in.ibm.com,
akpm@linux-foundation.org, mathieu.desnoyers@polymtl.ca,
josh@joshtriplett.org, niv@us.ibm.com, tglx@linutronix.de,
peterz@infradead.org, rostedt@goodmis.org, dhowells@redhat.com,
edumazet@google.com, darren@dvhart.com, fweisbec@gmail.com,
sbw@mit.edu, "Borislav Petkov" <bp@alien8.de>,
"Borislav Petkov" <bp@suse.de>, "Bjørn Mork" <bjorn@mork.no>
Subject: Re: [PATCH tip/core/rcu 1/9] rcu: Expedite grace periods during suspend/resume
Date: Tue, 20 Aug 2013 17:58:40 +0800 [thread overview]
Message-ID: <52133DD0.8030804@cn.fujitsu.com> (raw)
In-Reply-To: <1376966534-30775-1-git-send-email-paulmck@linux.vnet.ibm.com>
On 08/20/2013 10:42 AM, Paul E. McKenney wrote:
> From: Borislav Petkov <bp@alien8.de>
>
> CONFIG_RCU_FAST_NO_HZ can increase grace-period durations by up to
> a factor of four, which can result in long suspend and resume times.
> Thus, this commit temporarily switches to expedited grace periods when
> suspending the box and return to normal settings when resuming. Similar
> logic is applied to hibernation.
>
> Because expedited grace periods are of dubious benefit on very large
> systems, so this commit restricts their automated use during suspend
> and resume to systems of 256 or fewer CPUs. (Some day a number of
> Linux-kernel facilities, including RCU's expedited grace periods,
> will be more scalable, but I need to see bug reports first.)
>
> [ paulmck: This also papers over an audio/irq bug, but hopefully that will
> be fixed soon. ]
>
> Signed-off-by: Borislav Petkov <bp@suse.de>
> Signed-off-by: Bjørn Mork <bjorn@mork.no>
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Reviewed-by: Josh Triplett <josh@joshtriplett.org>
> ---
> kernel/rcutree.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> index 338f1d1..a7bf517 100644
> --- a/kernel/rcutree.c
> +++ b/kernel/rcutree.c
> @@ -54,6 +54,7 @@
> #include <linux/stop_machine.h>
> #include <linux/random.h>
> #include <linux/ftrace_event.h>
> +#include <linux/suspend.h>
>
> #include "rcutree.h"
> #include <trace/events/rcu.h>
> @@ -3032,6 +3033,25 @@ static int rcu_cpu_notify(struct notifier_block *self,
> return NOTIFY_OK;
> }
>
> +static int rcu_pm_notify(struct notifier_block *self,
> + unsigned long action, void *hcpu)
> +{
> + switch (action) {
> + case PM_HIBERNATION_PREPARE:
> + case PM_SUSPEND_PREPARE:
> + if (nr_cpu_ids <= 256) /* Expediting bad for large systems. */
> + rcu_expedited = 1;
> + break;
> + case PM_POST_HIBERNATION:
> + case PM_POST_SUSPEND:
> + rcu_expedited = 0;
Users can set it via sysfs, this notify will changes it.
I think we can introduce an rcu_expedited_syfs_saved;
thus we can change this line to:
- rcu_expedited = 0;
+ rcu_expedited = rcu_expedited_syfs_saved;
rcu_init() {
...
+ rcu_expedited_syfs_saved = rcu_expedited;
}
static ssize_t rcu_expedited_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t count)
{
if (kstrtoint(buf, 0, &rcu_expedited))
return -EINVAL;
+ rcu_expedited_syfs_saved = rcu_expedited;
return count;
}
> + break;
> + default:
> + break;
> + }
> + return NOTIFY_OK;
> +}
> +
> /*
> * Spawn the kthread that handles this RCU flavor's grace periods.
> */
> @@ -3273,6 +3293,7 @@ void __init rcu_init(void)
> * or the scheduler are operational.
> */
> cpu_notifier(rcu_cpu_notify, 0);
> + pm_notifier(rcu_pm_notify, 0);
> for_each_online_cpu(cpu)
> rcu_cpu_notify(NULL, CPU_UP_PREPARE, (void *)(long)cpu);
> }
next prev parent reply other threads:[~2013-08-20 9:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-20 2:41 [PATCH tip/core/rcu 0/9] v2 Fixes for 3.12 Paul E. McKenney
2013-08-20 2:42 ` [PATCH tip/core/rcu 1/9] rcu: Expedite grace periods during suspend/resume Paul E. McKenney
2013-08-20 2:42 ` [PATCH tip/core/rcu 2/9] rcu: Simplify debug-objects fixups Paul E. McKenney
2013-08-20 2:42 ` [PATCH tip/core/rcu 3/9] debugobjects: Make debug_object_activate() return status Paul E. McKenney
2013-08-20 2:42 ` [PATCH tip/core/rcu 4/9] rcu: Make call_rcu() leak callbacks for debug-object errors Paul E. McKenney
2013-08-20 2:42 ` [PATCH tip/core/rcu 5/9] rcu: Avoid redundant grace-period kthread wakeups Paul E. McKenney
2013-08-20 2:42 ` [PATCH tip/core/rcu 6/9] rculist: list_first_or_null_rcu() should use list_entry_rcu() Paul E. McKenney
2013-08-20 2:42 ` [PATCH tip/core/rcu 7/9] rcu: Select IRQ_WORK from TREE_PREEMPT_RCU Paul E. McKenney
2013-08-20 2:42 ` [PATCH tip/core/rcu 8/9] rcu: Simplify _rcu_barrier() processing Paul E. McKenney
2013-08-20 9:48 ` Lai Jiangshan
2013-08-20 18:50 ` Paul E. McKenney
2013-08-20 2:42 ` [PATCH tip/core/rcu 9/9] jiffies: Avoid undefined behavior from signed overflow Paul E. McKenney
2013-08-20 9:58 ` Lai Jiangshan [this message]
2013-08-20 18:42 ` [PATCH tip/core/rcu 1/9] rcu: Expedite grace periods during suspend/resume Paul E. McKenney
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=52133DD0.8030804@cn.fujitsu.com \
--to=laijs@cn.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=bjorn@mork.no \
--cc=bp@alien8.de \
--cc=bp@suse.de \
--cc=darren@dvhart.com \
--cc=dhowells@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=edumazet@google.com \
--cc=fweisbec@gmail.com \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@polymtl.ca \
--cc=mingo@elte.hu \
--cc=niv@us.ibm.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sbw@mit.edu \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).