[PATCH 03/14] cgroup: port to ns_ref_*() helpers

From: Christian Brauner

Date: Thu Sep 18 2025 - 06:13:31 EST


Stop accessing ns.count directly.

Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx>
---
include/linux/cgroup_namespace.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/cgroup_namespace.h b/include/linux/cgroup_namespace.h
index c02bb76c5e32..b7dbf4d623d2 100644
--- a/include/linux/cgroup_namespace.h
+++ b/include/linux/cgroup_namespace.h
@@ -29,12 +29,12 @@ int cgroup_path_ns(struct cgroup *cgrp, char *buf, size_t buflen,

static inline void get_cgroup_ns(struct cgroup_namespace *ns)
{
- refcount_inc(&ns->ns.count);
+ ns_ref_inc(ns);
}

static inline void put_cgroup_ns(struct cgroup_namespace *ns)
{
- if (refcount_dec_and_test(&ns->ns.count))
+ if (ns_ref_put(ns))
free_cgroup_ns(ns);
}


--
2.47.3