From: Waiman Long <longman@redhat.com>
To: Tejun Heo <tj@kernel.org>, Zefan Li <lizefan.x@bytedance.com>,
Johannes Weiner <hannes@cmpxchg.org>
Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
Waiman Long <longman@redhat.com>
Subject: [PATCH-cgroup 2/2] cgroup: Remove nr_cgrps
Date: Fri, 5 Jul 2024 20:56:22 -0400 [thread overview]
Message-ID: <20240706005622.2003606-2-longman@redhat.com> (raw)
In-Reply-To: <20240706005622.2003606-1-longman@redhat.com>
With the previous patch, the nr_cgrps field in the cgroup_root structure
is no longer being used. Just remove it.
Signed-off-by: Waiman Long <longman@redhat.com>
---
include/linux/cgroup-defs.h | 3 ---
kernel/cgroup/cgroup.c | 5 -----
2 files changed, 8 deletions(-)
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
index 522ab77f0406..542334bf72df 100644
--- a/include/linux/cgroup-defs.h
+++ b/include/linux/cgroup-defs.h
@@ -581,9 +581,6 @@ struct cgroup_root {
/* must follow cgrp for cgrp->ancestors[0], see above */
struct cgroup *cgrp_ancestor_storage;
- /* Number of cgroups in the hierarchy, used only for /proc/cgroups */
- atomic_t nr_cgrps;
-
/* Hierarchy-specific flags */
unsigned int flags;
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 4a818192950f..b6854ba702ca 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -1327,7 +1327,6 @@ static void cgroup_destroy_root(struct cgroup_root *root)
cgroup_lock_and_drain_offline(&cgrp_dfl_root.cgrp);
- BUG_ON(atomic_read(&root->nr_cgrps));
BUG_ON(!list_empty(&cgrp->self.children));
/* Rebind all subsystems back to the default hierarchy */
@@ -2061,7 +2060,6 @@ void init_cgroup_root(struct cgroup_fs_context *ctx)
struct cgroup *cgrp = &root->cgrp;
INIT_LIST_HEAD_RCU(&root->root_list);
- atomic_set(&root->nr_cgrps, 1);
cgrp->root = root;
init_cgroup_housekeeping(cgrp);
@@ -2159,7 +2157,6 @@ int cgroup_setup_root(struct cgroup_root *root, u16 ss_mask)
spin_unlock_irq(&css_set_lock);
BUG_ON(!list_empty(&root_cgrp->self.children));
- BUG_ON(atomic_read(&root->nr_cgrps) != 1);
ret = 0;
goto out;
@@ -5383,7 +5380,6 @@ static void css_free_rwork_fn(struct work_struct *work)
css_put(parent);
} else {
/* cgroup free path */
- atomic_dec(&cgrp->root->nr_cgrps);
if (!cgroup_on_dfl(cgrp))
cgroup1_pidlist_destroy_all(cgrp);
cancel_work_sync(&cgrp->release_agent_work);
@@ -5693,7 +5689,6 @@ static struct cgroup *cgroup_create(struct cgroup *parent, const char *name,
/* allocation complete, commit to creation */
list_add_tail_rcu(&cgrp->self.sibling, &cgroup_parent(cgrp)->self.children);
- atomic_inc(&root->nr_cgrps);
cgroup_get_live(parent);
/*
--
2.39.3
next prev parent reply other threads:[~2024-07-06 0:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-06 0:56 [PATCH-cgroup 1/2] cgroup: Show # of subsystem CSSes in /proc/cgroups Waiman Long
2024-07-06 0:56 ` Waiman Long [this message]
2024-07-08 18:45 ` Tejun Heo
2024-07-08 19:01 ` Waiman Long
2024-07-08 19:05 ` Tejun Heo
2024-07-08 19:18 ` Waiman Long
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=20240706005622.2003606-2-longman@redhat.com \
--to=longman@redhat.com \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan.x@bytedance.com \
--cc=tj@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®