Skip to contentSkip to conversation

sched/membarrier: fix missing local execution of ipi_sync_rq_state()

PATCH New Mathieu Desnoyers 1 participant 1 message Feb 17, 2021

Subsystems (3)
lore
Share & tools
lore

Mathieu Desnoyers

author maintainer
#0 lore raw

PATCH 1/1 sched/membarrier: fix missing local execution of ipi_sync_rq_state()

The function sync_runqueues_membarrier_state() should copy the membarrier state from the @mm received as parameter to each runqueue currently running tasks using that mm.

However, the use of smp_call_function_many() skips the current runqueue, which is unintended. Replace by a call to on_each_cpu_mask().

Fixes 227a4aadc75b ("sched/membarrier: Fix p->mm->membarrier_state racy load")
Cc Peter Zijlstra <[email protected]>
Cc Nadav Amit <[email protected]>
Cc [email protected] # 5.4.x+
---
 kernel/sched/membarrier.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
kernel/sched/membarrier.c +1 -3
index 08ae45ad9261..f311bf85d211 100644
@@ -471,9 +471,7 @@ static int sync_runqueues_membarrier_state(struct mm_struct *mm)
 	}
 	rcu_read_unlock();
 
-	preempt_disable();
-	smp_call_function_many(tmpmask, ipi_sync_rq_state, mm, 1);
-	preempt_enable();
+	on_each_cpu_mask(tmpmask, ipi_sync_rq_state, mm, true);
 
 	free_cpumask_var(tmpmask);
 	cpus_read_unlock();
Signature · 1 line
2.17.1