From: Christian Brauner <brauner@kernel.org>
To: linux-fsdevel@vger.kernel.org
Cc: "Amir Goldstein" <amir73il@gmail.com>,
"Josef Bacik" <josef@toxicpanda.com>,
"Jeff Layton" <jlayton@kernel.org>, "Mike Yuan" <me@yhndnzj.com>,
"Zbigniew Jędrzejewski-Szmek" <zbyszek@in.waw.pl>,
"Lennart Poettering" <mzxreary@0pointer.de>,
"Daan De Meyer" <daan.j.demeyer@gmail.com>,
"Aleksa Sarai" <cyphar@cyphar.com>,
"Alexander Viro" <viro@zeniv.linux.org.uk>,
"Jan Kara" <jack@suse.cz>, "Tejun Heo" <tj@kernel.org>,
"Johannes Weiner" <hannes@cmpxchg.org>,
"Michal Koutný" <mkoutny@suse.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Anna-Maria Behnsen" <anna-maria@linutronix.de>,
"Frederic Weisbecker" <frederic@kernel.org>,
"Thomas Gleixner" <tglx@linutronix.de>,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, "Christian Brauner" <brauner@kernel.org>
Subject: [PATCH 14/14] ns: rename to __ns_ref
Date: Thu, 18 Sep 2025 12:11:59 +0200 [thread overview]
Message-ID: <20250918-work-namespace-ns_ref-v1-14-1b0a98ee041e@kernel.org> (raw)
In-Reply-To: <20250918-work-namespace-ns_ref-v1-0-1b0a98ee041e@kernel.org>
Make it easier to grep and rename to ns_count.
Signed-off-by: Christian Brauner <brauner@kernel.org>
---
include/linux/ns_common.h | 12 ++++++------
init/version-timestamp.c | 2 +-
ipc/msgutil.c | 2 +-
kernel/cgroup/cgroup.c | 2 +-
kernel/nscommon.c | 2 +-
kernel/pid.c | 2 +-
kernel/time/namespace.c | 2 +-
kernel/user.c | 2 +-
8 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/include/linux/ns_common.h b/include/linux/ns_common.h
index a65da646aef7..24bbeb5161a5 100644
--- a/include/linux/ns_common.h
+++ b/include/linux/ns_common.h
@@ -29,7 +29,7 @@ struct ns_common {
struct dentry *stashed;
const struct proc_ns_operations *ops;
unsigned int inum;
- refcount_t count;
+ refcount_t __ns_ref; /* do not use directly */
union {
struct {
u64 ns_id;
@@ -95,19 +95,19 @@ void __ns_common_free(struct ns_common *ns);
static __always_inline __must_check bool __ns_ref_put(struct ns_common *ns)
{
- return refcount_dec_and_test(&ns->count);
+ return refcount_dec_and_test(&ns->__ns_ref);
}
static __always_inline __must_check bool __ns_ref_get(struct ns_common *ns)
{
- return refcount_inc_not_zero(&ns->count);
+ return refcount_inc_not_zero(&ns->__ns_ref);
}
-#define ns_ref_read(__ns) refcount_read(&to_ns_common((__ns))->count)
-#define ns_ref_inc(__ns) refcount_inc(&to_ns_common((__ns))->count)
+#define ns_ref_read(__ns) refcount_read(&to_ns_common((__ns))->__ns_ref)
+#define ns_ref_inc(__ns) refcount_inc(&to_ns_common((__ns))->__ns_ref)
#define ns_ref_get(__ns) __ns_ref_get(to_ns_common((__ns)))
#define ns_ref_put(__ns) __ns_ref_put(to_ns_common((__ns)))
#define ns_ref_put_and_lock(__ns, __lock) \
- refcount_dec_and_lock(&to_ns_common((__ns))->count, (__lock))
+ refcount_dec_and_lock(&to_ns_common((__ns))->__ns_ref, (__lock))
#endif
diff --git a/init/version-timestamp.c b/init/version-timestamp.c
index 043cbf80a766..547e522e6016 100644
--- a/init/version-timestamp.c
+++ b/init/version-timestamp.c
@@ -8,7 +8,7 @@
#include <linux/utsname.h>
struct uts_namespace init_uts_ns = {
- .ns.count = REFCOUNT_INIT(2),
+ .ns.__ns_ref = REFCOUNT_INIT(2),
.name = {
.sysname = UTS_SYSNAME,
.nodename = UTS_NODENAME,
diff --git a/ipc/msgutil.c b/ipc/msgutil.c
index bbf61275df41..d0f7dcf4c208 100644
--- a/ipc/msgutil.c
+++ b/ipc/msgutil.c
@@ -27,7 +27,7 @@ DEFINE_SPINLOCK(mq_lock);
* and not CONFIG_IPC_NS.
*/
struct ipc_namespace init_ipc_ns = {
- .ns.count = REFCOUNT_INIT(1),
+ .ns.__ns_ref = REFCOUNT_INIT(1),
.user_ns = &init_user_ns,
.ns.inum = PROC_IPC_INIT_INO,
#ifdef CONFIG_IPC_NS
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 092e6bf081ed..a0e24adceef0 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -219,7 +219,7 @@ static bool have_favordynmods __ro_after_init = IS_ENABLED(CONFIG_CGROUP_FAVOR_D
/* cgroup namespace for init task */
struct cgroup_namespace init_cgroup_ns = {
- .ns.count = REFCOUNT_INIT(2),
+ .ns.__ns_ref = REFCOUNT_INIT(2),
.user_ns = &init_user_ns,
.ns.ops = &cgroupns_operations,
.ns.inum = PROC_CGROUP_INIT_INO,
diff --git a/kernel/nscommon.c b/kernel/nscommon.c
index 7c1b07e2a6c9..7aa2be6a0c32 100644
--- a/kernel/nscommon.c
+++ b/kernel/nscommon.c
@@ -5,7 +5,7 @@
int __ns_common_init(struct ns_common *ns, const struct proc_ns_operations *ops, int inum)
{
- refcount_set(&ns->count, 1);
+ refcount_set(&ns->__ns_ref, 1);
ns->stashed = NULL;
ns->ops = ops;
ns->ns_id = 0;
diff --git a/kernel/pid.c b/kernel/pid.c
index c45a28c16cd2..e222426f745d 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -71,7 +71,7 @@ static int pid_max_max = PID_MAX_LIMIT;
* the scheme scales to up to 4 million PIDs, runtime.
*/
struct pid_namespace init_pid_ns = {
- .ns.count = REFCOUNT_INIT(2),
+ .ns.__ns_ref = REFCOUNT_INIT(2),
.idr = IDR_INIT(init_pid_ns.idr),
.pid_allocated = PIDNS_ADDING,
.level = 0,
diff --git a/kernel/time/namespace.c b/kernel/time/namespace.c
index d49c73015d6e..d70bdfb7b001 100644
--- a/kernel/time/namespace.c
+++ b/kernel/time/namespace.c
@@ -480,7 +480,7 @@ const struct proc_ns_operations timens_for_children_operations = {
};
struct time_namespace init_time_ns = {
- .ns.count = REFCOUNT_INIT(3),
+ .ns.__ns_ref = REFCOUNT_INIT(3),
.user_ns = &init_user_ns,
.ns.inum = PROC_TIME_INIT_INO,
.ns.ops = &timens_operations,
diff --git a/kernel/user.c b/kernel/user.c
index f46b1d41163b..17a742fb4e10 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -65,7 +65,7 @@ struct user_namespace init_user_ns = {
.nr_extents = 1,
},
},
- .ns.count = REFCOUNT_INIT(3),
+ .ns.__ns_ref = REFCOUNT_INIT(3),
.owner = GLOBAL_ROOT_UID,
.group = GLOBAL_ROOT_GID,
.ns.inum = PROC_USER_INIT_INO,
--
2.47.3
next prev parent reply other threads:[~2025-09-18 10:13 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-18 10:11 [PATCH 00/14] ns: rework reference counting Christian Brauner
2025-09-18 10:11 ` [PATCH 01/14] ns: add reference count helpers Christian Brauner
2025-09-18 10:11 ` [PATCH 02/14] mnt: port to ns_ref_*() helpers Christian Brauner
2025-09-18 10:11 ` [PATCH 03/14] cgroup: " Christian Brauner
2025-09-18 15:51 ` Tejun Heo
2025-09-18 10:11 ` [PATCH 04/14] ipc: " Christian Brauner
2025-09-18 10:11 ` [PATCH 05/14] pid: " Christian Brauner
2025-09-18 10:11 ` [PATCH 06/14] time: " Christian Brauner
2025-09-21 7:36 ` Thomas Gleixner
2025-09-18 10:11 ` [PATCH 07/14] user: " Christian Brauner
2025-09-18 10:11 ` [PATCH 08/14] net-sysfs: use check_net() Christian Brauner
2025-09-18 10:11 ` [PATCH 09/14] net: " Christian Brauner
2025-09-18 10:11 ` [PATCH 10/14] ipv4: " Christian Brauner
2025-09-18 10:11 ` [PATCH 11/14] uts: port to ns_ref_*() helpers Christian Brauner
2025-09-18 10:11 ` [PATCH 12/14] net: " Christian Brauner
2025-09-18 10:11 ` [PATCH 13/14] nsfs: " Christian Brauner
2025-09-18 10:11 ` Christian Brauner [this message]
2025-09-18 12:12 ` [PATCH 14/14] ns: rename to __ns_ref Michal Koutný
2025-09-21 7:37 ` Thomas Gleixner
2025-09-18 10:41 ` [PATCH 00/14] ns: rework reference counting Jan Kara
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=20250918-work-namespace-ns_ref-v1-14-1b0a98ee041e@kernel.org \
--to=brauner@kernel.org \
--cc=amir73il@gmail.com \
--cc=anna-maria@linutronix.de \
--cc=cgroups@vger.kernel.org \
--cc=cyphar@cyphar.com \
--cc=daan.j.demeyer@gmail.com \
--cc=frederic@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=jack@suse.cz \
--cc=jlayton@kernel.org \
--cc=josef@toxicpanda.com \
--cc=kuba@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=me@yhndnzj.com \
--cc=mkoutny@suse.com \
--cc=mzxreary@0pointer.de \
--cc=netdev@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=zbyszek@in.waw.pl \
/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;
as well as URLs for NNTP newsgroup(s).