From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
To: a.p.zijlstra@chello.nl, mingo@kernel.org, pjt@google.com,
paul@paulmenage.org, akpm@linux-foundation.org
Cc: rjw@sisk.pl, nacc@us.ibm.com, paulmck@linux.vnet.ibm.com,
tglx@linutronix.de, seto.hidetoshi@jp.fujitsu.com, tj@kernel.org,
mschmidt@redhat.com, berrange@redhat.com,
nikunj@linux.vnet.ibm.com, vatsa@linux.vnet.ibm.com,
liuj97@gmail.com, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org, srivatsa.bhat@linux.vnet.ibm.com
Subject: [PATCH v3 4/5] cpusets: Add provisions for distinguishing CPU Hotplug in suspend/resume path
Date: Mon, 14 May 2012 04:46:54 +0530 [thread overview]
Message-ID: <20120513231638.3566.30867.stgit@srivatsabhat> (raw)
In-Reply-To: <20120513231325.3566.37740.stgit@srivatsabhat>
Cpusets needs to distinguish between a regular CPU Hotplug operation and a
CPU Hotplug operation carried out as part of the suspend/resume sequence.
So add provisions to facilitate that, so that the two operations can be
handled differently.
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Cc: stable@vger.kernel.org
---
include/linux/cpuset.h | 2 +-
kernel/cpuset.c | 19 ++++++++++++++++---
kernel/sched/core.c | 29 +++++++++++++++++++++++------
3 files changed, 40 insertions(+), 10 deletions(-)
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 838320f..184cb94 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -20,7 +20,7 @@ extern int number_of_cpusets; /* How many cpusets are defined in system? */
extern int cpuset_init(void);
extern void cpuset_init_smp(void);
-extern void cpuset_update_active_cpus(bool cpu_online);
+extern void cpuset_update_active_cpus(bool cpu_online, bool frozen);
extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask);
extern void cpuset_cpus_allowed_fallback(struct task_struct *p);
extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 0fb9bff..0723183 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -151,6 +151,8 @@ typedef enum {
enum hotplug_event {
CPUSET_CPU_OFFLINE,
CPUSET_CPU_ONLINE,
+ CPUSET_CPU_OFFLINE_FROZEN,
+ CPUSET_CPU_ONLINE_FROZEN,
CPUSET_MEM_OFFLINE,
};
@@ -2077,6 +2079,12 @@ scan_cpusets_upon_hotplug(struct cpuset *root, enum hotplug_event event)
}
break;
+ case CPUSET_CPU_OFFLINE_FROZEN:
+ break;
+
+ case CPUSET_CPU_ONLINE_FROZEN:
+ break;
+
case CPUSET_CPU_ONLINE:
/*
* Restore only the top_cpuset because it has to track
@@ -2132,19 +2140,24 @@ scan_cpusets_upon_hotplug(struct cpuset *root, enum hotplug_event event)
*
* @cpu_online: Indicates whether this is a CPU online event (true) or
* a CPU offline event (false).
+ * @frozen: Indicates whether the tasks are frozen (true) or not (false)
+ * Frozen tasks indicates a CPU hotplug operation in the suspend/resume path.
*/
-void cpuset_update_active_cpus(bool cpu_online)
+void cpuset_update_active_cpus(bool cpu_online, bool frozen)
{
struct sched_domain_attr *attr;
+ enum hotplug_event event;
cpumask_var_t *doms;
int ndoms;
cgroup_lock();
if (cpu_online)
- scan_cpusets_upon_hotplug(&top_cpuset, CPUSET_CPU_ONLINE);
+ event = frozen ? CPUSET_CPU_ONLINE_FROZEN : CPUSET_CPU_ONLINE;
else
- scan_cpusets_upon_hotplug(&top_cpuset, CPUSET_CPU_OFFLINE);
+ event = frozen ? CPUSET_CPU_OFFLINE_FROZEN : CPUSET_CPU_OFFLINE;
+
+ scan_cpusets_upon_hotplug(&top_cpuset, event);
ndoms = generate_sched_domains(&doms, &attr);
cgroup_unlock();
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 55cfe8c..08463d5 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6809,26 +6809,43 @@ int __init sched_create_sysfs_power_savings_entries(struct device *dev)
static int cpuset_cpu_active(struct notifier_block *nfb, unsigned long action,
void *hcpu)
{
- switch (action & ~CPU_TASKS_FROZEN) {
+ bool frozen;
+
+ switch (action) {
case CPU_ONLINE:
case CPU_DOWN_FAILED:
- cpuset_update_active_cpus(true);
- return NOTIFY_OK;
+ frozen = false;
+ break;
+ case CPU_ONLINE_FROZEN:
+ case CPU_DOWN_FAILED_FROZEN:
+ frozen = true;
+ break;
default:
return NOTIFY_DONE;
}
+
+ cpuset_update_active_cpus(true, frozen);
+ return NOTIFY_OK;
}
static int cpuset_cpu_inactive(struct notifier_block *nfb, unsigned long action,
void *hcpu)
{
- switch (action & ~CPU_TASKS_FROZEN) {
+ bool frozen;
+
+ switch (action) {
case CPU_DOWN_PREPARE:
- cpuset_update_active_cpus(false);
- return NOTIFY_OK;
+ frozen = false;
+ break;
+ case CPU_DOWN_PREPARE_FROZEN:
+ frozen = true;
+ break;
default:
return NOTIFY_DONE;
}
+
+ cpuset_update_active_cpus(false, frozen);
+ return NOTIFY_OK;
}
void __init sched_init_smp(void)
next prev parent reply other threads:[~2012-05-13 23:17 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-13 23:14 [PATCH v3 0/5] CPU hotplug, cpusets: Fix issues with cpusets handling during suspend/resume Srivatsa S. Bhat
2012-05-13 23:15 ` [PATCH v3 1/5] cpusets, hotplug: Implement cpuset tree traversal in a helper function Srivatsa S. Bhat
2012-05-15 0:03 ` David Rientjes
2012-05-15 12:15 ` Srivatsa S. Bhat
2012-05-15 18:04 ` David Rientjes
2012-05-13 23:15 ` [PATCH v3 2/5] cpusets, hotplug: Restructure functions that are invoked during hotplug Srivatsa S. Bhat
2012-05-15 0:27 ` David Rientjes
2012-05-15 12:25 ` Srivatsa S. Bhat
2012-05-13 23:16 ` [PATCH v3 3/5] cpusets: Update tasks' cpus_allowed mask upon updates to root cpuset Srivatsa S. Bhat
2012-05-15 0:31 ` David Rientjes
2012-05-13 23:16 ` Srivatsa S. Bhat [this message]
2012-05-15 0:33 ` [PATCH v3 4/5] cpusets: Add provisions for distinguishing CPU Hotplug in suspend/resume path David Rientjes
2012-05-15 12:29 ` Srivatsa S. Bhat
2012-05-15 18:34 ` David Rientjes
2012-05-15 19:17 ` Srivatsa S. Bhat
2012-05-15 20:39 ` David Rientjes
2012-05-13 23:17 ` [PATCH v3 5/5] cpusets, suspend: Save and restore cpusets during suspend/resume Srivatsa S. Bhat
2012-05-15 0:37 ` David Rientjes
2012-05-15 1:40 ` Nishanth Aravamudan
2012-05-15 4:04 ` David Rientjes
2012-05-15 4:45 ` Nishanth Aravamudan
2012-05-15 18:31 ` David Rientjes
2012-05-15 20:10 ` Peter Zijlstra
2012-05-15 21:05 ` David Rientjes
2012-05-15 21:08 ` Peter Zijlstra
2012-05-15 21:21 ` Srivatsa S. Bhat
2012-05-15 21:24 ` Peter Zijlstra
2012-05-15 21:24 ` David Rientjes
2012-05-15 21:42 ` Srivatsa S. Bhat
2012-05-15 21:49 ` David Rientjes
2012-05-15 22:16 ` Srivatsa S. Bhat
2012-05-15 22:32 ` David Rientjes
2012-05-16 8:20 ` Srivatsa S. Bhat
2012-05-16 8:42 ` Srivatsa S. Bhat
2012-05-16 21:24 ` Peter Zijlstra
2012-05-17 9:57 ` Srivatsa S. Bhat
2012-05-15 21:13 ` Peter Zijlstra
2012-05-15 21:37 ` David Rientjes
2012-05-15 9:24 ` Srivatsa S. Bhat
2012-05-14 23:58 ` [PATCH v3 0/5] CPU hotplug, cpusets: Fix issues with cpusets handling " David Rientjes
2012-05-15 12:10 ` Srivatsa S. Bhat
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=20120513231638.3566.30867.stgit@srivatsabhat \
--to=srivatsa.bhat@linux.vnet.ibm.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=berrange@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=liuj97@gmail.com \
--cc=mingo@kernel.org \
--cc=mschmidt@redhat.com \
--cc=nacc@us.ibm.com \
--cc=nikunj@linux.vnet.ibm.com \
--cc=paul@paulmenage.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=pjt@google.com \
--cc=rjw@sisk.pl \
--cc=seto.hidetoshi@jp.fujitsu.com \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
--cc=vatsa@linux.vnet.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox