Skip to content

Commit 279f2c2

Browse files
Sebastian Andrzej SiewiorPeter Zijlstra
authored andcommitted
futex: Use RCU_INIT_POINTER() in futex_mm_init().
There is no need for an explicit NULL pointer initialisation plus a comment why it is okay. RCU_INIT_POINTER() can be used for NULL initialisations and it is documented. This has been build tested with gcc version 9.3.0 (Debian 9.3.0-22) on a x86-64 defconfig. Fixes: 094ac8c ("futex: Relax the rcu_assign_pointer() assignment of mm->futex_phash in futex_mm_init()") Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 7d4f494 commit 279f2c2

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

include/linux/futex.h

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,7 @@ void futex_hash_free(struct mm_struct *mm);
8888

8989
static inline void futex_mm_init(struct mm_struct *mm)
9090
{
91-
/*
92-
* No need for rcu_assign_pointer() here, as we can rely on
93-
* tasklist_lock write-ordering in copy_process(), before
94-
* the task's MM becomes visible and the ->futex_phash
95-
* becomes externally observable:
96-
*/
97-
mm->futex_phash = NULL;
98-
91+
RCU_INIT_POINTER(mm->futex_phash, NULL);
9992
mutex_init(&mm->futex_hash_lock);
10093
}
10194

0 commit comments

Comments
 (0)