mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Sebastian Andrzej Siewior" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: locking/futex] futex: Use RCU_INIT_POINTER() in futex_mm_init().
Date: Wed, 21 May 2025 12:06:08 -0000	[thread overview]
Message-ID: <174782916844.406.17946927892328892389.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20250517151455.1065363-4-bigeasy@linutronix.de>

The following commit has been merged into the locking/futex branch of tip:

Commit-ID:     279f2c2c8e2169403d01190f042efa6e41731578
Gitweb:        https://git.kernel.org/tip/279f2c2c8e2169403d01190f042efa6e41731578
Author:        Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate:    Sat, 17 May 2025 17:14:53 +02:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Wed, 21 May 2025 13:57:41 +02:00

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: 094ac8cff7858 ("futex: Relax the rcu_assign_pointer() assignment of mm->futex_phash in futex_mm_init()")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20250517151455.1065363-4-bigeasy@linutronix.de
---
 include/linux/futex.h |  9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/include/linux/futex.h b/include/linux/futex.h
index 168ffd5..005b040 100644
--- a/include/linux/futex.h
+++ b/include/linux/futex.h
@@ -88,14 +88,7 @@ void futex_hash_free(struct mm_struct *mm);
 
 static inline void futex_mm_init(struct mm_struct *mm)
 {
-	/*
-	 * No need for rcu_assign_pointer() here, as we can rely on
-	 * tasklist_lock write-ordering in copy_process(), before
-	 * the task's MM becomes visible and the ->futex_phash
-	 * becomes externally observable:
-	 */
-	mm->futex_phash = NULL;
-
+	RCU_INIT_POINTER(mm->futex_phash, NULL);
 	mutex_init(&mm->futex_hash_lock);
 }
 

  reply	other threads:[~2025-05-21 12:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-17 15:14 [PATCH v2 0/5] futex: Random fixes after the private-hash series Sebastian Andrzej Siewior
2025-05-17 15:14 ` [PATCH v2 1/5] selftests/futex: Use TAP output in futex_priv_hash Sebastian Andrzej Siewior
2025-05-21 12:06   ` [tip: locking/futex] " tip-bot2 for Sebastian Andrzej Siewior
2025-05-17 15:14 ` [PATCH v2 2/5] selftests/futex: Use TAP output in futex_numa_mpol Sebastian Andrzej Siewior
2025-05-21 12:06   ` [tip: locking/futex] " tip-bot2 for Sebastian Andrzej Siewior
2025-05-17 15:14 ` [PATCH v2 3/5] futex: Use RCU_INIT_POINTER() in futex_mm_init() Sebastian Andrzej Siewior
2025-05-21 12:06   ` tip-bot2 for Sebastian Andrzej Siewior [this message]
2025-05-17 15:14 ` [PATCH v2 4/5] tools headers: Synchronize prctl.h ABI header Sebastian Andrzej Siewior
2025-05-21 12:06   ` [tip: locking/futex] " tip-bot2 for Sebastian Andrzej Siewior
2025-05-17 15:14 ` [PATCH v2 5/5] futex: Correct the kernedoc return value for futex_wait_setup() Sebastian Andrzej Siewior
2025-05-21 12:06   ` [tip: locking/futex] " tip-bot2 for Sebastian Andrzej Siewior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=174782916844.406.17946927892328892389.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®