Skip to content

Commit 2229933

Browse files
author
Peter Zijlstra
committed
futex: Remove pointless mmgrap() + mmdrop()
We always set 'key->private.mm' to 'current->mm', getting an extra reference on 'current->mm' is quite pointless, because as long as the task is blocked it isn't going to go away. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
1 parent 3867913 commit 2229933

1 file changed

Lines changed: 1 addition & 13 deletions

File tree

‎kernel/futex.c‎

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -331,17 +331,6 @@ static void compat_exit_robust_list(struct task_struct *curr);
331331
static inline void compat_exit_robust_list(struct task_struct *curr) { }
332332
#endif
333333

334-
static inline void futex_get_mm(union futex_key *key)
335-
{
336-
mmgrab(key->private.mm);
337-
/*
338-
* Ensure futex_get_mm() implies a full barrier such that
339-
* get_futex_key() implies a full barrier. This is relied upon
340-
* as smp_mb(); (B), see the ordering comment above.
341-
*/
342-
smp_mb__after_atomic();
343-
}
344-
345334
/*
346335
* Reflects a new waiter being added to the waitqueue.
347336
*/
@@ -432,7 +421,7 @@ static void get_futex_key_refs(union futex_key *key)
432421
smp_mb(); /* explicit smp_mb(); (B) */
433422
break;
434423
case FUT_OFF_MMSHARED:
435-
futex_get_mm(key); /* implies smp_mb(); (B) */
424+
smp_mb(); /* explicit smp_mb(); (B) */
436425
break;
437426
default:
438427
/*
@@ -465,7 +454,6 @@ static void drop_futex_key_refs(union futex_key *key)
465454
case FUT_OFF_INODE:
466455
break;
467456
case FUT_OFF_MMSHARED:
468-
mmdrop(key->private.mm);
469457
break;
470458
}
471459
}

0 commit comments

Comments
 (0)