lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120207185717.7482.45388.stgit@srivatsabhat.in.ibm.com>
Date:	Wed, 08 Feb 2012 00:27:36 +0530
From:	"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>
To:	paul@...lmenage.org, a.p.zijlstra@...llo.nl, mingo@...e.hu,
	rjw@...k.pl, tj@...nel.org
Cc:	frank.rowand@...sony.com, pjt@...gle.com, tglx@...utronix.de,
	lizf@...fujitsu.com, prashanth@...ux.vnet.ibm.com,
	paulmck@...ux.vnet.ibm.com, vatsa@...ux.vnet.ibm.com,
	srivatsa.bhat@...ux.vnet.ibm.com, linux-kernel@...r.kernel.org,
	linux-pm@...r.kernel.org
Subject: [PATCH 4/4] CPU hotplug,
 cpusets: Differentiate the CPU online and CPU offline callbacks

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@...ux.vnet.ibm.com>
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@...ux.vnet.ibm.com>
Cc: stable@...r.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;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ