Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sched/preempt, futex: Update comments to clarify that preemption doesn't have to be disabled

As arm64 and arc have no special implementations for !CONFIG_SMP, mutual
exclusion doesn't seem to rely on preemption.

Let's make it clear in the comments that preemption doesn't have to be
disabled when accessing user space in the futex code, so we can remove
preempt_disable() from pagefault_disable().

Reviewed-and-tested-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: David.Laight@ACULAB.COM
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: airlied@linux.ie
Cc: akpm@linux-foundation.org
Cc: benh@kernel.crashing.org
Cc: bigeasy@linutronix.de
Cc: borntraeger@de.ibm.com
Cc: daniel.vetter@intel.com
Cc: heiko.carstens@de.ibm.com
Cc: herbert@gondor.apana.org.au
Cc: hocko@suse.cz
Cc: hughd@google.com
Cc: mst@redhat.com
Cc: paulus@samba.org
Cc: ralf@linux-mips.org
Cc: schwidefsky@de.ibm.com
Cc: yang.shi@windriver.com
Link: http://lkml.kernel.org/r/1431359540-32227-13-git-send-email-dahi@linux.vnet.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

David Hildenbrand and committed by
Ingo Molnar
2f09b227 388b0e0a

+7 -7
+5 -5
arch/arc/include/asm/futex.h
··· 53 53 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int))) 54 54 return -EFAULT; 55 55 56 - pagefault_disable(); /* implies preempt_disable() */ 56 + pagefault_disable(); 57 57 58 58 switch (op) { 59 59 case FUTEX_OP_SET: ··· 75 75 ret = -ENOSYS; 76 76 } 77 77 78 - pagefault_enable(); /* subsumes preempt_enable() */ 78 + pagefault_enable(); 79 79 80 80 if (!ret) { 81 81 switch (cmp) { ··· 104 104 return ret; 105 105 } 106 106 107 - /* Compare-xchg with preemption disabled. 107 + /* Compare-xchg with pagefaults disabled. 108 108 * Notes: 109 109 * -Best-Effort: Exchg happens only if compare succeeds. 110 110 * If compare fails, returns; leaving retry/looping to upper layers ··· 121 121 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int))) 122 122 return -EFAULT; 123 123 124 - pagefault_disable(); /* implies preempt_disable() */ 124 + pagefault_disable(); 125 125 126 126 /* TBD : can use llock/scond */ 127 127 __asm__ __volatile__( ··· 142 142 : "r"(oldval), "r"(newval), "r"(uaddr), "ir"(-EFAULT) 143 143 : "cc", "memory"); 144 144 145 - pagefault_enable(); /* subsumes preempt_enable() */ 145 + pagefault_enable(); 146 146 147 147 *uval = val; 148 148 return val;
+2 -2
arch/arm64/include/asm/futex.h
··· 58 58 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32))) 59 59 return -EFAULT; 60 60 61 - pagefault_disable(); /* implies preempt_disable() */ 61 + pagefault_disable(); 62 62 63 63 switch (op) { 64 64 case FUTEX_OP_SET: ··· 85 85 ret = -ENOSYS; 86 86 } 87 87 88 - pagefault_enable(); /* subsumes preempt_enable() */ 88 + pagefault_enable(); 89 89 90 90 if (!ret) { 91 91 switch (cmp) {