Skip to contentSkip to conversation

printk: Avoid scheduling printing threads on the same CPU

PATCH Sergey Senozhatsky 1 participant 1 message Dec 10, 2015

lore
Share & tools
lore
#0 lore raw
Quoted 12 lines
(quoted diff) +12 -0
+static void distribute_printing_kthreads(void)
+{
+	int i;
+	unsigned int cpus_per_thread;
+	unsigned int cpu, seen_cpu;
+
+	for (i = 0; i < PRINTING_TASKS; i++)
+		cpumask_clear(printing_kthread_mask[i]);
+
+	cpus_per_thread = DIV_ROUND_UP(num_online_cpus(), PRINTING_TASKS);
+	seen_cpu = 0;
+	for_each_online_cpu(cpu) {

Review

Quoted 10 lines
(quoted diff) +10 -0
+		cpumask_set_cpu(cpu,
+			printing_kthread_mask[seen_cpu / cpus_per_thread]);
+		seen_cpu++;
+	}
+
+	for (i = 0; i < PRINTING_TASKS; i++)
+		if (!cpumask_empty(printing_kthread_mask[i]))
+			set_cpus_allowed_ptr(printing_kthread[i],
+					     printing_kthread_mask[i]);
+}

I certainly understand what are you trying to do here, but I'm a bit concerned. This may result in 'bad' affinities on big.LITTLE platforms, for example. So I think that printk is not quite good place for that type of decisions. Just my 5 cents.

	-ss