Skip to content

Commit fc0d773

Browse files
compudjIngo Molnar
authored andcommitted
sched/membarrier: Fix private expedited registration check
Fix a logic flaw in the way membarrier_register_private_expedited() handles ready state checks for private expedited sync core and private expedited registrations. If a private expedited membarrier registration is first performed, and then a private expedited sync_core registration is performed, the ready state check will skip the second registration when it really should not. Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Chris Metcalf <cmetcalf@ezchip.com> Cc: Christoph Lameter <cl@linux.com> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Kirill Tkhai <tkhai@yandex.ru> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Paul E. McKenney <paulmck@linux.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Russell King - ARM Linux admin <linux@armlinux.org.uk> Cc: Thomas Gleixner <tglx@linutronix.de> Link: https://lkml.kernel.org/r/20190919173705.2181-2-mathieu.desnoyers@efficios.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 5311a98 commit fc0d773

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/sched/membarrier.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ static int membarrier_register_private_expedited(int flags)
226226
* groups, which use the same mm. (CLONE_VM but not
227227
* CLONE_THREAD).
228228
*/
229-
if (atomic_read(&mm->membarrier_state) & state)
229+
if ((atomic_read(&mm->membarrier_state) & state) == state)
230230
return 0;
231231
atomic_or(MEMBARRIER_STATE_PRIVATE_EXPEDITED, &mm->membarrier_state);
232232
if (flags & MEMBARRIER_FLAG_SYNC_CORE)

0 commit comments

Comments
 (0)