Skip to content

Commit 2f09b22

Browse files
David HildenbrandIngo Molnar
authored andcommitted
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>
1 parent 388b0e0 commit 2f09b22

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

arch/arc/include/asm/futex.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static inline int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr)
5353
if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
5454
return -EFAULT;
5555

56-
pagefault_disable(); /* implies preempt_disable() */
56+
pagefault_disable();
5757

5858
switch (op) {
5959
case FUTEX_OP_SET:
@@ -75,7 +75,7 @@ static inline int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr)
7575
ret = -ENOSYS;
7676
}
7777

78-
pagefault_enable(); /* subsumes preempt_enable() */
78+
pagefault_enable();
7979

8080
if (!ret) {
8181
switch (cmp) {
@@ -104,7 +104,7 @@ static inline int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr)
104104
return ret;
105105
}
106106

107-
/* Compare-xchg with preemption disabled.
107+
/* Compare-xchg with pagefaults disabled.
108108
* Notes:
109109
* -Best-Effort: Exchg happens only if compare succeeds.
110110
* If compare fails, returns; leaving retry/looping to upper layers
@@ -121,7 +121,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, u32 oldval,
121121
if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
122122
return -EFAULT;
123123

124-
pagefault_disable(); /* implies preempt_disable() */
124+
pagefault_disable();
125125

126126
/* TBD : can use llock/scond */
127127
__asm__ __volatile__(
@@ -142,7 +142,7 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, u32 oldval,
142142
: "r"(oldval), "r"(newval), "r"(uaddr), "ir"(-EFAULT)
143143
: "cc", "memory");
144144

145-
pagefault_enable(); /* subsumes preempt_enable() */
145+
pagefault_enable();
146146

147147
*uval = val;
148148
return val;

arch/arm64/include/asm/futex.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr)
5858
if (!access_ok(VERIFY_WRITE, uaddr, sizeof(u32)))
5959
return -EFAULT;
6060

61-
pagefault_disable(); /* implies preempt_disable() */
61+
pagefault_disable();
6262

6363
switch (op) {
6464
case FUTEX_OP_SET:
@@ -85,7 +85,7 @@ futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr)
8585
ret = -ENOSYS;
8686
}
8787

88-
pagefault_enable(); /* subsumes preempt_enable() */
88+
pagefault_enable();
8989

9090
if (!ret) {
9191
switch (cmp) {

0 commit comments

Comments
 (0)