Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1423552

[PATCH tip/core/rcu 8/8] torture: Affinity waiter tasks away from hotpluggable CPU

From "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject [PATCH tip/core/rcu 8/8] torture: Affinity waiter tasks away from hotpluggable CPU
Date 2016-06-16 00:30 +0200
Message-ID <rKrtU-8sD-21@gated-at.bofh.it> (permalink)
References <rKrtU-8sD-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 kernel/rcu/waketorture.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/kernel/rcu/waketorture.c b/kernel/rcu/waketorture.c
index f9843eb3f7b7..68be40400f51 100644
--- a/kernel/rcu/waketorture.c
+++ b/kernel/rcu/waketorture.c
@@ -236,7 +236,9 @@ static int wake_torture_waiter(void *arg)
  */
 static int wake_torture_onoff(void *args)
 {
+	cpumask_var_t cm;
 	int cpu;
+	int i;
 
 	VERBOSE_TOROUT_STRING("wake_torture_onoff task started");
 	if (onoff_holdoff > 0) {
@@ -244,6 +246,11 @@ static int wake_torture_onoff(void *args)
 		schedule_timeout_interruptible(onoff_holdoff * HZ);
 		VERBOSE_TOROUT_STRING("wake_torture_onoff end holdoff");
 	}
+
+	/*
+	 * Find the last hotpluggable CPU, and affinity the waiter
+	 * tasks elsewhere.
+	 */
 	for_each_online_cpu(cpu) {
 		if (cpu_is_hotpluggable(cpu))
 			onoff_cpu = cpu;
@@ -257,6 +264,18 @@ static int wake_torture_onoff(void *args)
 		}
 	}
 	pr_alert("%s" TORTURE_FLAG " wake_torture_onoff: onoff_cpu: %d\n", torture_type, onoff_cpu);
+	if (!zalloc_cpumask_var(&cm, GFP_KERNEL)) {
+		VERBOSE_TOROUT_STRING("wake_torture_onoff: Out of memory, no affinity");
+	} else {
+		cpumask_copy(cm, cpu_online_mask);
+		cpumask_clear_cpu(onoff_cpu, cm);
+		if (cpumask_weight(cm) == 0)
+			cpumask_setall(cm);
+		for (i = 0; i < nrealwaiters; i++)
+			set_cpus_allowed_ptr(waiter_tasks[i], cm);
+	}
+
+	/* Cycle the victim CPU online and offline! */
 	while (!torture_must_stop() && onoff_cpu >= 0) {
 		if (!torture_offline(onoff_cpu,
 				    &n_offline_attempts, &n_offline_successes,
-- 
2.5.2

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH RFC tip/core/rcu 0/8] Waketorture, not for inclusion "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-16 00:30 +0200
  [PATCH tip/core/rcu 7/8] torture: Make waketorture kill test if no hotpluggable CPUs "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-16 00:30 +0200
  [PATCH tip/core/rcu 6/8] torture: Make waketorture always hotplug the same CPU "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-16 00:30 +0200
  [PATCH tip/core/rcu 4/8] waketorture: Add utilization measurement "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-16 00:30 +0200
  [PATCH tip/core/rcu 8/8] torture: Affinity waiter tasks away from hotpluggable CPU "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-16 00:30 +0200
  [PATCH tip/core/rcu 1/8] waketorture: Add a wakeup-torture module "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-16 00:30 +0200
  [PATCH tip/core/rcu 5/8] waketorture: Add hrtimer support "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-16 00:40 +0200

csiph-web