public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: "Bjørn Mork" <bjorn@mork.no>
Cc: "Paul E. McKenney" <paul.mckenney@linaro.org>,
	linux-kernel@vger.kernel.org
Subject: Re: Bisected post-3.9 regression: Resume takes 5 times as much time as with v3.9
Date: Sun, 12 May 2013 04:31:57 -0700	[thread overview]
Message-ID: <20130512113157.GG3648@linux.vnet.ibm.com> (raw)
In-Reply-To: <87r4hdjsu5.fsf@nemi.mork.no>

On Sat, May 11, 2013 at 08:04:50PM +0200, Bjørn Mork wrote:
> Hello,
> 
> resuming from system suspend is intolerably slow in current mainline. I
> am not the most patient person around, and I actually started out
> bisecting this believing it was hanging...  Turned out it wasn't really
> hanging.  It just took 15 seconds to wake up from suspend-to-ram.
> Timing v3.9 I found that it used less than 3 seconds on this ancient
> laptop I'm using.
> 
> Bisecting it ended up pointing to
> 
> commit c0f4dfd4f90f1667d234d21f15153ea09a2eaa66
> Author: Paul E. McKenney <paul.mckenney@linaro.org>
> Date:   Fri Dec 28 11:30:36 2012 -0800
> 
>     rcu: Make RCU_FAST_NO_HZ take advantage of numbered callbacks
>     
>     Because RCU callbacks are now associated with the number of the grace
>     period that they must wait for, CPUs can now take advance callbacks
>     corresponding to grace periods that ended while a given CPU was in
>     dyntick-idle mode.  This eliminates the need to try forcing the RCU
>     state machine while entering idle, thus reducing the CPU intensiveness
>     of RCU_FAST_NO_HZ, which should increase its energy efficiency.
>     
>     Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
>     Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> 
> 
> 
> Being a big patch, I'm pretty sure that the problem is some minor
> issue. But rather than trying to userstand this, just tried reverting
> it on top of the current mainline and can confirm that this fixes the
> regression.  I'll leave the understanding to you :)
> 
> I'm attaching the revert patch as I had to fix a conflict, and may have
> done something wrong there.  I'm also attaching my .config.
> 
> Let me know if you need more information, or want me to try out proposed
> fixes.

We don't want to back out the RCU_FAST_NO_HZ changes due to their
energy-efficiency benefits.  So could you please try out Borislav's
patch below?  He ran into the same issue a few weeks ago, and this
one fixed it for him.

							Thanx, Paul

------------------------------------------------------------------------

rcu: Expedite grace periods during suspend/resume

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.

Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index a9610d1..d9604a4 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -53,6 +53,7 @@
 #include <linux/delay.h>
 #include <linux/stop_machine.h>
 #include <linux/random.h>
+#include <linux/suspend.h>
 
 #include "rcutree.h"
 #include <trace/events/rcu.h>
@@ -3003,6 +3004,22 @@ static int __cpuinit 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:
+		rcu_expedited = 1;
+		break;
+	case PM_POST_RESTORE:
+		rcu_expedited = 0;
+		break;
+	default:
+		break;
+	}
+	return NOTIFY_OK;
+}
+
 /*
  * Spawn the kthread that handles this RCU flavor's grace periods.
  */
@@ -3243,6 +3260,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);
 }


  reply	other threads:[~2013-05-12 11:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-11 18:04 Bisected post-3.9 regression: Resume takes 5 times as much time as with v3.9 Bjørn Mork
2013-05-12 11:31 ` Paul E. McKenney [this message]
2013-05-12 16:13   ` Bjørn Mork
2013-05-12 16:27     ` Borislav Petkov
2013-05-12 16:56       ` Bjørn Mork
2013-05-12 17:20         ` Borislav Petkov
2013-05-13 11:30           ` Rafael J. Wysocki
2013-05-13 12:00             ` [PATCH] hibernate: Correct documentation Borislav Petkov
2013-05-14  6:34               ` Rob Landley
2013-05-14  7:42                 ` Borislav Petkov
2013-05-14 10:38     ` Bisected post-3.9 regression: Resume takes 5 times as much time as with v3.9 Paul E. McKenney
2013-05-12 18:29   ` Joerg Roedel
2013-05-12 20:57     ` Paul E. McKenney
2013-05-12 21:34       ` Joerg Roedel
2013-05-13  1:35         ` Paul E. McKenney
2013-05-13  6:00           ` Joerg Roedel
2013-05-13 14:00           ` Paul E. McKenney
2013-05-14 17:37             ` Joerg Roedel
2013-05-14 17:49               ` 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=20130512113157.GG3648@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=bjorn@mork.no \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul.mckenney@linaro.org \
    /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