[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250826034022.1736249-4-chenridong@huaweicloud.com>
Date: Tue, 26 Aug 2025 03:40:22 +0000
From: Chen Ridong <chenridong@...weicloud.com>
To: tj@...nel.org,
hannes@...xchg.org,
mkoutny@...e.com
Cc: cgroups@...r.kernel.org,
linux-kernel@...r.kernel.org,
lujialin4@...wei.com,
chenridong@...wei.com
Subject: [PATCH cgroup/for-next 3/3] cgroup: rename css offline related functions
From: Chen Ridong <chenridong@...wei.com>
The cgroup_destroy_wq has been split into three separate workqueues:
cgroup_offline_wq, cgroup_release_wq, and cgroup_free_wq. The cgroup
destroy work is now enqueued sequentially into these queues. To clarify
the three distinct stages of the destruction process, it will introduce
helper functions or rename existing ones accordingly. The resulting
structure is as follows:
work workqueue work_fn
css_offline cgroup_offline_wq css_offline_work_fn
css_release cgroup_release_wq css_release_work_fn
css_free cgroup_free_wq css_free_rwork_fn
This patch renames css_killed_ref_fn to css_offline_work_fn and
css_killed_work_fn to css_offline_work_fn to align with the new
multi-phase destruction workflow.
Signed-off-by: Chen Ridong <chenridong@...wei.com>
---
kernel/cgroup/cgroup.c | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index ad1f6a59a27b..1c75ebad7a88 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -5447,20 +5447,20 @@ static struct cftype cgroup_psi_files[] = {
/*
* css destruction is four-stage process.
*
- * 1. Destruction starts. Killing of the percpu_ref is initiated.
- * Implemented in kill_css().
+ * 1. kill_css: Destruction starts. Killing of the percpu_ref is
+ * initiated. Implemented in kill_css().
*
- * 2. When the percpu_ref is confirmed to be visible as killed on all CPUs
- * and thus css_tryget_online() is guaranteed to fail, the css can be
- * offlined by invoking offline_css(). After offlining, the base ref is
- * put. Implemented in css_killed_work_fn().
+ * 2. css_offline: When the percpu_ref is confirmed to be visible as
+ * killed on all CPUs and thus css_tryget_online() is guaranteed to
+ * fail, the css can be offlined by invoking __css_offline(). After
+ * offlining, the base ref is put. Implemented in css_offline_work_fn().
*
- * 3. When the percpu_ref reaches zero, the only possible remaining
- * accessors are inside RCU read sections. css_release() schedules the
- * RCU callback.
+ * 3. css_release: When the percpu_ref reaches zero, the only possible
+ * remaining accessors are inside RCU read sections. css_release()
+ * schedules the RCU callback.
*
- * 4. After the grace period, the css can be freed. Implemented in
- * css_free_rwork_fn().
+ * 4. css_free: After the grace period, the css can be freed. Implemented
+ * in css_free_rwork_fn().
*
* It is actually hairier because both step 2 and 4 require process context
* and thus involve punting to css->destroy_work adding two additional
@@ -5642,7 +5642,7 @@ static int online_css(struct cgroup_subsys_state *css)
}
/* if the CSS is online, invoke ->css_offline() on it and mark it offline */
-static void offline_css(struct cgroup_subsys_state *css)
+static void __css_offline(struct cgroup_subsys_state *css)
{
struct cgroup_subsys *ss = css->ss;
@@ -5936,7 +5936,7 @@ int cgroup_mkdir(struct kernfs_node *parent_kn, const char *name, umode_t mode)
* css_tryget_online() is now guaranteed to fail. Tell the subsystem to
* initiate destruction and put the css ref from kill_css().
*/
-static void css_killed_work_fn(struct work_struct *work)
+static void css_offline_work_fn(struct work_struct *work)
{
struct cgroup_subsys_state *css =
container_of(work, struct cgroup_subsys_state, destroy_work);
@@ -5944,7 +5944,7 @@ static void css_killed_work_fn(struct work_struct *work)
cgroup_lock();
do {
- offline_css(css);
+ __css_offline(css);
css_put(css);
/* @css can't go away while we're holding cgroup_mutex */
css = css->parent;
@@ -5954,13 +5954,13 @@ static void css_killed_work_fn(struct work_struct *work)
}
/* css kill confirmation processing requires process context, bounce */
-static void css_killed_ref_fn(struct percpu_ref *ref)
+static void css_offline(struct percpu_ref *ref)
{
struct cgroup_subsys_state *css =
container_of(ref, struct cgroup_subsys_state, refcnt);
if (!css->nr_descendants) {
- INIT_WORK(&css->destroy_work, css_killed_work_fn);
+ INIT_WORK(&css->destroy_work, css_offline_work_fn);
queue_work(cgroup_offline_wq, &css->destroy_work);
}
}
@@ -6011,7 +6011,7 @@ static void kill_css(struct cgroup_subsys_state *css)
* Use percpu_ref_kill_and_confirm() to get notifications as each
* css is confirmed to be seen as killed on all CPUs.
*/
- percpu_ref_kill_and_confirm(&css->refcnt, css_killed_ref_fn);
+ percpu_ref_kill_and_confirm(&css->refcnt, css_offline);
}
/**
--
2.34.1
Powered by blists - more mailing lists