mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Wagner <daniel.wagner@bmw-carit.de>
To: linux-kernel@vger.kernel.org
Cc: Daniel Wagner <daniel.wagner@bmw-carit.de>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>
Subject: [RFC v0 5/9] sched: Use freeze_active() instead CPU_*_FROZEN state information
Date: Fri,  4 Sep 2015 15:34:58 +0200	[thread overview]
Message-ID: <1441373702-31796-6-git-send-email-daniel.wagner@bmw-carit.de> (raw)
In-Reply-To: <1441373702-31796-1-git-send-email-daniel.wagner@bmw-carit.de>

In order to get rid of all CPU_*_FROZEN states we need to convert all
users first.

cpuset_cpu_active() tracks via num_cpus_frozen if the current CPU is
the last one. So there is no need to track the exact CPU is in
a CPU_*_FROZEN state. Instead we can probe freeze_active() to tell
if supsens or resume is ongoing.

Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org
---
 kernel/sched/core.c | 48 +++++++++++++++++++++++++-----------------------
 1 file changed, 25 insertions(+), 23 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 5de2c9e..36b00eb 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -74,6 +74,7 @@
 #include <linux/binfmts.h>
 #include <linux/context_tracking.h>
 #include <linux/compiler.h>
+#include <linux/suspend.h>
 
 #include <asm/switch_to.h>
 #include <asm/tlb.h>
@@ -7128,28 +7129,28 @@ static int cpuset_cpu_active(struct notifier_block *nfb, unsigned long action,
 			     void *hcpu)
 {
 	switch (action) {
-	case CPU_ONLINE_FROZEN:
-	case CPU_DOWN_FAILED_FROZEN:
-
-		/*
-		 * num_cpus_frozen tracks how many CPUs are involved in suspend
-		 * resume sequence. As long as this is not the last online
-		 * operation in the resume sequence, just build a single sched
-		 * domain, ignoring cpusets.
-		 */
-		num_cpus_frozen--;
-		if (likely(num_cpus_frozen)) {
-			partition_sched_domains(1, NULL, NULL);
-			break;
+	case CPU_ONLINE:
+	case CPU_DOWN_FAILED:
+		if (freeze_active()) {
+			/*
+			 * num_cpus_frozen tracks how many CPUs are
+			 * involved in suspend resume sequence. As
+			 * long as this is not the last online
+			 * operation in the resume sequence, just
+			 * build a single sched domain, ignoring
+			 * cpusets.
+			 */
+			num_cpus_frozen--;
+			if (likely(num_cpus_frozen)) {
+				partition_sched_domains(1, NULL, NULL);
+				break;
+			}
 		}
-
 		/*
-		 * This is the last CPU online operation. So fall through and
-		 * restore the original sched domains by considering the
-		 * cpuset configurations.
+		 * This is the last CPU online operation. Restore the
+		 * original sched domains by considering the cpuset
+		 * configurations.
 		 */
-
-	case CPU_ONLINE:
 		cpuset_update_active_cpus(true);
 		break;
 	default:
@@ -7169,6 +7170,11 @@ static int cpuset_cpu_inactive(struct notifier_block *nfb, unsigned long action,
 
 	switch (action) {
 	case CPU_DOWN_PREPARE:
+		if (freeze_active()) {
+			num_cpus_frozen++;
+			partition_sched_domains(1, NULL, NULL);
+			break;
+		}
 		rcu_read_lock_sched();
 		dl_b = dl_bw_of(cpu);
 
@@ -7183,10 +7189,6 @@ static int cpuset_cpu_inactive(struct notifier_block *nfb, unsigned long action,
 			return notifier_from_errno(-EBUSY);
 		cpuset_update_active_cpus(false);
 		break;
-	case CPU_DOWN_PREPARE_FROZEN:
-		num_cpus_frozen++;
-		partition_sched_domains(1, NULL, NULL);
-		break;
 	default:
 		return NOTIFY_DONE;
 	}
-- 
2.4.3


  parent reply	other threads:[~2015-09-04 13:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-04 13:34 [RFC v0 0/9] Remove CPU_*_FROZEN Daniel Wagner
2015-09-04 13:34 ` [RFC v0 1/9] smpboot: Add a separate CPU state when a surviving CPU times out Daniel Wagner
2015-09-04 13:34 ` [RFC v0 2/9] suspend: Add getter function to report if freezing is active Daniel Wagner
2015-09-05  2:11   ` Rafael J. Wysocki
2015-09-07  8:55     ` Daniel Wagner
2015-09-07 13:42       ` Rafael J. Wysocki
2015-09-07 21:44       ` Rafael J. Wysocki
2015-09-08  8:19         ` Daniel Wagner
2015-09-04 13:34 ` [RFC v0 3/9] x86: Use freeze_active() instead of CPU_*_FROZEN Daniel Wagner
2015-09-04 13:34 ` [RFC v0 4/9] smpboot: Use freeze_active() instead CPU_DEAD_FROZEN state information Daniel Wagner
2015-09-08  8:49   ` Daniel Wagner
2015-09-04 13:34 ` Daniel Wagner [this message]
2015-09-04 13:34 ` [RFC v0 6/9] cpu: Restructure FROZEN state handling Daniel Wagner
2015-09-04 13:35 ` [RFC v0 7/9] cpu: Remove unused CPU_*_FROZEN states Daniel Wagner
2015-09-04 13:35 ` [RFC v0 8/9] cpu: Do not set CPU_TASKS_FROZEN anymore Daniel Wagner
2015-09-04 13:35 ` [RFC v0 9/9] doc: Update cpu-hotplug documents on removal of CPU_TASKS_FROZEN Daniel Wagner

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=1441373702-31796-6-git-send-email-daniel.wagner@bmw-carit.de \
    --to=daniel.wagner@bmw-carit.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.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

all inboxes | Powered by JetHome®