History

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.

Peter Zijlstra committed 6 years ago

Commit 22299331 parent 38679131 file · +1 −13Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/futex.c+1−13
@@ -331,17 +331,6 @@ static void compat_exit_robust_list(struct task_struct *curr); · 330 unmodified lines
331static inline void compat_exit_robust_list(struct task_struct *curr) { }331static inline void compat_exit_robust_list(struct task_struct *curr) { }
332#endif332#endif
333 333
334static 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
345/*334/*
346 * Reflects a new waiter being added to the waitqueue.335 * Reflects a new waiter being added to the waitqueue.
347 */336 */
@@ -432,7 +421,7 @@ static void get_futex_key_refs(union futex_key *key) · 84 unmodified lines
432 smp_mb(); /* explicit smp_mb(); (B) */421 smp_mb(); /* explicit smp_mb(); (B) */
433 break;422 break;
434 case FUT_OFF_MMSHARED:423 case FUT_OFF_MMSHARED:
435 futex_get_mm(key); /* implies smp_mb(); (B) */424 smp_mb(); /* explicit smp_mb(); (B) */
436 break;425 break;
437 default:426 default:
438 /*427 /*
@@ -465,7 +454,6 @@ static void drop_futex_key_refs(union futex_key *key) · 26 unmodified lines
465 case FUT_OFF_INODE:454 case FUT_OFF_INODE:
466 break;455 break;
467 case FUT_OFF_MMSHARED:456 case FUT_OFF_MMSHARED:
468 mmdrop(key->private.mm);
469 break;457 break;
470 }458 }
471}459}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t