Skip to content

Commit

Permalink
futex: Remove pointless mmgrap() + mmdrop()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Peter Zijlstra committed Mar 6, 2020
1 parent 3867913 commit 2229933
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions kernel/futex.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,17 +331,6 @@ static void compat_exit_robust_list(struct task_struct *curr);
static inline void compat_exit_robust_list(struct task_struct *curr) { }
#endif

static inline void futex_get_mm(union futex_key *key)
{
mmgrab(key->private.mm);
/*
* Ensure futex_get_mm() implies a full barrier such that
* get_futex_key() implies a full barrier. This is relied upon
* as smp_mb(); (B), see the ordering comment above.
*/
smp_mb__after_atomic();
}

/*
* Reflects a new waiter being added to the waitqueue.
*/
Expand Down Expand Up @@ -432,7 +421,7 @@ static void get_futex_key_refs(union futex_key *key)
smp_mb(); /* explicit smp_mb(); (B) */
break;
case FUT_OFF_MMSHARED:
futex_get_mm(key); /* implies smp_mb(); (B) */
smp_mb(); /* explicit smp_mb(); (B) */
break;
default:
/*
Expand Down Expand Up @@ -465,7 +454,6 @@ static void drop_futex_key_refs(union futex_key *key)
case FUT_OFF_INODE:
break;
case FUT_OFF_MMSHARED:
mmdrop(key->private.mm);
break;
}
}
Expand Down

0 comments on commit 2229933

Please sign in to comment.