aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2006-12-06 23:32:20 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 11:39:21 -0500
commita866374aecc90c7d90619727ccd851ac096b2fc7 (patch)
treeeabae0b36b5281dcef20563470c7f05549689b8c /kernel
parent6edaf68a87d17570790fd55f0c451a29ec1d6703 (diff)
[PATCH] mm: pagefault_{disable,enable}()
Introduce pagefault_{disable,enable}() and use these where previously we did manual preempt increments/decrements to make the pagefault handler do the atomic thing. Currently they still rely on the increased preempt count, but do not rely on the disabled preemption, this might go away in the future. (NOTE: the extra barrier() in pagefault_disable might fix some holes on machines which have too many registers for their own good) [heiko.carstens@de.ibm.com: s390 fix] Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Acked-by: Nick Piggin <npiggin@suse.de> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/futex.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/kernel/futex.c b/kernel/futex.c
index 93ef30ba209f..af7b81cbde30 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -282,9 +282,9 @@ static inline int get_futex_value_locked(u32 *dest, u32 __user *from)
282{ 282{
283 int ret; 283 int ret;
284 284
285 inc_preempt_count(); 285 pagefault_disable();
286 ret = __copy_from_user_inatomic(dest, from, sizeof(u32)); 286 ret = __copy_from_user_inatomic(dest, from, sizeof(u32));
287 dec_preempt_count(); 287 pagefault_enable();
288 288
289 return ret ? -EFAULT : 0; 289 return ret ? -EFAULT : 0;
290} 290}
@@ -585,9 +585,9 @@ static int wake_futex_pi(u32 __user *uaddr, u32 uval, struct futex_q *this)
585 if (!(uval & FUTEX_OWNER_DIED)) { 585 if (!(uval & FUTEX_OWNER_DIED)) {
586 newval = FUTEX_WAITERS | new_owner->pid; 586 newval = FUTEX_WAITERS | new_owner->pid;
587 587
588 inc_preempt_count(); 588 pagefault_disable();
589 curval = futex_atomic_cmpxchg_inatomic(uaddr, uval, newval); 589 curval = futex_atomic_cmpxchg_inatomic(uaddr, uval, newval);
590 dec_preempt_count(); 590 pagefault_enable();
591 if (curval == -EFAULT) 591 if (curval == -EFAULT)
592 return -EFAULT; 592 return -EFAULT;
593 if (curval != uval) 593 if (curval != uval)
@@ -618,9 +618,9 @@ static int unlock_futex_pi(u32 __user *uaddr, u32 uval)
618 * There is no waiter, so we unlock the futex. The owner died 618 * There is no waiter, so we unlock the futex. The owner died
619 * bit has not to be preserved here. We are the owner: 619 * bit has not to be preserved here. We are the owner:
620 */ 620 */
621 inc_preempt_count(); 621 pagefault_disable();
622 oldval = futex_atomic_cmpxchg_inatomic(uaddr, uval, 0); 622 oldval = futex_atomic_cmpxchg_inatomic(uaddr, uval, 0);
623 dec_preempt_count(); 623 pagefault_enable();
624 624
625 if (oldval == -EFAULT) 625 if (oldval == -EFAULT)
626 return oldval; 626 return oldval;
@@ -1158,9 +1158,9 @@ static int futex_lock_pi(u32 __user *uaddr, int detect, unsigned long sec,
1158 */ 1158 */
1159 newval = current->pid; 1159 newval = current->pid;
1160 1160
1161 inc_preempt_count(); 1161 pagefault_disable();
1162 curval = futex_atomic_cmpxchg_inatomic(uaddr, 0, newval); 1162 curval = futex_atomic_cmpxchg_inatomic(uaddr, 0, newval);
1163 dec_preempt_count(); 1163 pagefault_enable();
1164 1164
1165 if (unlikely(curval == -EFAULT)) 1165 if (unlikely(curval == -EFAULT))
1166 goto uaddr_faulted; 1166 goto uaddr_faulted;
@@ -1183,9 +1183,9 @@ static int futex_lock_pi(u32 __user *uaddr, int detect, unsigned long sec,
1183 uval = curval; 1183 uval = curval;
1184 newval = uval | FUTEX_WAITERS; 1184 newval = uval | FUTEX_WAITERS;
1185 1185
1186 inc_preempt_count(); 1186 pagefault_disable();
1187 curval = futex_atomic_cmpxchg_inatomic(uaddr, uval, newval); 1187 curval = futex_atomic_cmpxchg_inatomic(uaddr, uval, newval);
1188 dec_preempt_count(); 1188 pagefault_enable();
1189 1189
1190 if (unlikely(curval == -EFAULT)) 1190 if (unlikely(curval == -EFAULT))
1191 goto uaddr_faulted; 1191 goto uaddr_faulted;
@@ -1215,10 +1215,10 @@ static int futex_lock_pi(u32 __user *uaddr, int detect, unsigned long sec,
1215 newval = current->pid | 1215 newval = current->pid |
1216 FUTEX_OWNER_DIED | FUTEX_WAITERS; 1216 FUTEX_OWNER_DIED | FUTEX_WAITERS;
1217 1217
1218 inc_preempt_count(); 1218 pagefault_disable();
1219 curval = futex_atomic_cmpxchg_inatomic(uaddr, 1219 curval = futex_atomic_cmpxchg_inatomic(uaddr,
1220 uval, newval); 1220 uval, newval);
1221 dec_preempt_count(); 1221 pagefault_enable();
1222 1222
1223 if (unlikely(curval == -EFAULT)) 1223 if (unlikely(curval == -EFAULT))
1224 goto uaddr_faulted; 1224 goto uaddr_faulted;
@@ -1390,9 +1390,9 @@ retry_locked:
1390 * anyone else up: 1390 * anyone else up:
1391 */ 1391 */
1392 if (!(uval & FUTEX_OWNER_DIED)) { 1392 if (!(uval & FUTEX_OWNER_DIED)) {
1393 inc_preempt_count(); 1393 pagefault_disable();
1394 uval = futex_atomic_cmpxchg_inatomic(uaddr, current->pid, 0); 1394 uval = futex_atomic_cmpxchg_inatomic(uaddr, current->pid, 0);
1395 dec_preempt_count(); 1395 pagefault_enable();
1396 } 1396 }
1397 1397
1398 if (unlikely(uval == -EFAULT)) 1398 if (unlikely(uval == -EFAULT))