From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
To: paul@paulmenage.org, a.p.zijlstra@chello.nl, mingo@elte.hu,
rjw@sisk.pl, tj@kernel.org
Cc: frank.rowand@am.sony.com, pjt@google.com, tglx@linutronix.de,
lizf@cn.fujitsu.com, prashanth@linux.vnet.ibm.com,
paulmck@linux.vnet.ibm.com, vatsa@linux.vnet.ibm.com,
srivatsa.bhat@linux.vnet.ibm.com, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org
Subject: [PATCH 4/4] CPU hotplug, cpusets: Differentiate the CPU online and CPU offline callbacks
Date: Wed, 08 Feb 2012 00:27:36 +0530 [thread overview]
Message-ID: <20120207185717.7482.45388.stgit@srivatsabhat.in.ibm.com> (raw)
In-Reply-To: <20120207185411.7482.43576.stgit@srivatsabhat.in.ibm.com>
Call scan_cpusets_during_cpu_online() upon CPU online events and
call scan_for_empty_cpusets() upon CPU offline events.
Reported-by: Prashanth K. Nageshappa <prashanth@linux.vnet.ibm.com>
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Cc: stable@vger.kernel.org
---
include/linux/cpuset.h | 4 ++--
kernel/cpuset.c | 9 +++++++--
kernel/sched/core.c | 12 ++++++++++--
3 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index e9eaec5..acfe484 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(void);
+extern void cpuset_update_active_cpus(bool cpu_online);
extern void cpuset_cpus_allowed(struct task_struct *p, struct cpumask *mask);
extern int cpuset_cpus_allowed_fallback(struct task_struct *p);
extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
@@ -133,7 +133,7 @@ static inline void set_mems_allowed(nodemask_t nodemask)
static inline int cpuset_init(void) { return 0; }
static inline void cpuset_init_smp(void) {}
-static inline void cpuset_update_active_cpus(void)
+static inline void cpuset_update_active_cpus(bool cpu_online)
{
partition_sched_domains(1, NULL, NULL);
}
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index c56e705..d863df5 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -2223,8 +2223,10 @@ static void scan_for_empty_cpusets(struct cpuset *root)
*
* Called within get_online_cpus(). Needs to call cgroup_lock()
* before calling generate_sched_domains().
+ *
+ * @cpu_online: whether this is a CPU online event or a CPU offline event.
*/
-void cpuset_update_active_cpus(void)
+void cpuset_update_active_cpus(bool cpu_online)
{
struct sched_domain_attr *attr;
cpumask_var_t *doms;
@@ -2234,7 +2236,10 @@ void cpuset_update_active_cpus(void)
mutex_lock(&callback_mutex);
cpumask_copy(top_cpuset.cpus_allowed, cpu_active_mask);
mutex_unlock(&callback_mutex);
- scan_for_empty_cpusets(&top_cpuset);
+ if (cpu_online)
+ scan_cpusets_during_cpu_online(&top_cpuset);
+ else
+ scan_for_empty_cpusets(&top_cpuset);
ndoms = generate_sched_domains(&doms, &attr);
cgroup_unlock();
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 5255c9d..d4dd9ef 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6732,7 +6732,11 @@ static int cpuset_cpu_active(struct notifier_block *nfb, unsigned long action,
switch (action & ~CPU_TASKS_FROZEN) {
case CPU_ONLINE:
case CPU_DOWN_FAILED:
- cpuset_update_active_cpus();
+ /*
+ * The 'true' value indicates that we are calling the function
+ * due to a CPU online operation in progress.
+ */
+ cpuset_update_active_cpus(true);
return NOTIFY_OK;
default:
return NOTIFY_DONE;
@@ -6744,7 +6748,11 @@ static int cpuset_cpu_inactive(struct notifier_block *nfb, unsigned long action,
{
switch (action & ~CPU_TASKS_FROZEN) {
case CPU_DOWN_PREPARE:
- cpuset_update_active_cpus();
+ /*
+ * The 'false' value indicates that we are calling the function
+ * due to a CPU offline operation in progress.
+ */
+ cpuset_update_active_cpus(false);
return NOTIFY_OK;
default:
return NOTIFY_DONE;
next prev parent reply other threads:[~2012-02-07 18:57 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-07 18:55 [PATCH 0/4] CPU hotplug, cpusets: Fix CPU online handling related to cpusets Srivatsa S. Bhat
2012-02-07 18:56 ` [PATCH 1/4] CPU hotplug, cpuset: Maintain a copy of the cpus_allowed mask before CPU hotplug Srivatsa S. Bhat
2012-02-07 18:56 ` [PATCH 2/4] cpuset: Split up update_cpumask() so that its functionality can be reused Srivatsa S. Bhat
2012-02-07 18:57 ` [PATCH 3/4] cpuset: Add function to introduce CPUs to cpusets during CPU online Srivatsa S. Bhat
2012-02-07 18:57 ` Srivatsa S. Bhat [this message]
2012-02-08 3:22 ` [PATCH 0/4] CPU hotplug, cpusets: Fix CPU online handling related to cpusets Peter Zijlstra
2012-02-08 6:33 ` Srivatsa S. Bhat
2012-02-09 7:57 ` Ingo Molnar
2012-02-09 8:42 ` Srivatsa S. Bhat
2012-02-09 15:11 ` Ingo Molnar
2012-02-10 15:52 ` Peter Zijlstra
2012-02-10 16:53 ` Paul E. McKenney
2012-02-10 17:34 ` Peter Zijlstra
2012-02-10 21:51 ` Alan Stern
2012-02-10 22:39 ` Rafael J. Wysocki
2012-02-11 2:07 ` Peter Zijlstra
2012-02-11 4:26 ` Srivatsa S. Bhat
2012-02-13 17:47 ` Srivatsa S. Bhat
2012-02-17 12:15 ` Srivatsa S. Bhat
2012-02-20 12:49 ` Peter Zijlstra
2012-02-20 12:59 ` Srivatsa S. Bhat
2012-02-23 9:57 ` Srivatsa S. Bhat
2012-02-24 23:24 ` Rafael J. Wysocki
2012-02-27 10:18 ` Peter Zijlstra
2012-02-27 12:09 ` [tip:sched/urgent] CPU hotplug, cpusets, suspend: Don' t touch cpusets during suspend/resume tip-bot for Srivatsa S. Bhat
2012-02-11 16:00 ` [PATCH 0/4] CPU hotplug, cpusets: Fix CPU online handling related to cpusets Paul E. McKenney
2012-02-13 17:47 ` Srivatsa S. Bhat
2012-02-13 20:39 ` Paul E. McKenney
2012-02-13 20:49 ` Srivatsa S. Bhat
2012-02-11 13:39 ` Ingo Molnar
2012-02-10 15:53 ` Peter Zijlstra
2012-02-09 16:43 ` Peter Zijlstra
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=20120207185717.7482.45388.stgit@srivatsabhat.in.ibm.com \
--to=srivatsa.bhat@linux.vnet.ibm.com \
--cc=a.p.zijlstra@chello.nl \
--cc=frank.rowand@am.sony.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=mingo@elte.hu \
--cc=paul@paulmenage.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=pjt@google.com \
--cc=prashanth@linux.vnet.ibm.com \
--cc=rjw@sisk.pl \
--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;
as well as URLs for NNTP newsgroup(s).