summaryrefslogtreecommitdiff
path: root/kernel/cgroup
diff options
context:
space:
mode:
authorGuopeng Zhang <zhangguopeng@kylinos.cn>2026-08-11 16:30:27 +0800
committerTejun Heo <tj@kernel.org>2026-08-11 15:43:08 -1000
commit6dd5d93f6c48a461157c73b9e2ce7f6d19d57f5a (patch)
tree77dbe21672049d18437e6acfc4eff0793f597e16 /kernel/cgroup
parent3345c7248a9e2a91cb9e2477c29af16881706f4f (diff)
cgroup/cpuset: Remove obsolete PFA_SPREAD_SLAB task flag
Commit 16a1d968358a ("mm/slab: remove mm/slab.c and slab_def.h") removed the SLAB allocator, the only allocator that implemented cpuset slab spreading. Commit 61a182ab61a6 ("cgroup/cpuset: Remove cpuset_do_slab_mem_spread()") then removed the last task_spread_slab() caller. Commit 3ab67a9ce82f ("cgroup/cpuset: Mark memory_spread_slab as obsolete") marked the legacy control obsolete. cpuset still updates PFA_SPREAD_SLAB when tasks attach to a legacy cpuset and walks all tasks in a cpuset when memory_spread_slab changes. Remove the unused task flag and its helpers, and make spread task updates depend only on memory_spread_page. Keep the memory_spread_slab control and CS_SPREAD_SLAB state so legacy users retain the existing write, readback and inheritance behavior. Update the comments and documentation to describe only page-cache spreading as functional. Assisted-by: LLM Signed-off-by: Guopeng Zhang <zhangguopeng@kylinos.cn> Reviewed-by: Waiman Long <longman@redhat.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/cgroup')
-rw-r--r--kernel/cgroup/cpuset-v1.c13
-rw-r--r--kernel/cgroup/cpuset.c19
2 files changed, 11 insertions, 21 deletions
diff --git a/kernel/cgroup/cpuset-v1.c b/kernel/cgroup/cpuset-v1.c
index 3e9968dd91e9..562ad35f00d0 100644
--- a/kernel/cgroup/cpuset-v1.c
+++ b/kernel/cgroup/cpuset-v1.c
@@ -204,7 +204,7 @@ static s64 cpuset_read_s64(struct cgroup_subsys_state *css, struct cftype *cft)
}
/*
- * update task's spread flag if cpuset's page/slab spread flag is set
+ * Update a task's spread flag if the cpuset's page spread flag is set.
*
* Call with callback_lock or cpuset_mutex held. The check can be skipped
* if on default hierarchy.
@@ -219,18 +219,13 @@ void cpuset1_update_task_spread_flags(struct cpuset *cs,
task_set_spread_page(tsk);
else
task_clear_spread_page(tsk);
-
- if (is_spread_slab(cs))
- task_set_spread_slab(tsk);
- else
- task_clear_spread_slab(tsk);
}
/**
- * cpuset1_update_tasks_flags - update the spread flags of tasks in the cpuset.
- * @cs: the cpuset in which each task's spread flags needs to be changed
+ * cpuset1_update_tasks_flags - update the page spread flag of cpuset tasks
+ * @cs: the cpuset whose tasks need their page spread flag updated
*
- * Iterate through each task of @cs updating its spread flags. As this
+ * Iterate through each task of @cs updating its page spread flag. As this
* function is called with cpuset_mutex held, cpuset membership stays
* stable.
*/
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 550812e7c274..0c34013eda8e 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -2859,7 +2859,7 @@ int cpuset_update_flag(cpuset_flagbits_t bit, struct cpuset *cs,
{
struct cpuset *trialcs;
int balance_flag_changed;
- int spread_flag_changed;
+ int spread_page_changed;
int err;
trialcs = dup_or_alloc_cpuset(cs);
@@ -2878,8 +2878,7 @@ int cpuset_update_flag(cpuset_flagbits_t bit, struct cpuset *cs,
balance_flag_changed = (is_sched_load_balance(cs) !=
is_sched_load_balance(trialcs));
- spread_flag_changed = ((is_spread_slab(cs) != is_spread_slab(trialcs))
- || (is_spread_page(cs) != is_spread_page(trialcs)));
+ spread_page_changed = is_spread_page(cs) != is_spread_page(trialcs);
spin_lock_irq(&callback_lock);
cs->flags = trialcs->flags;
@@ -2892,7 +2891,7 @@ int cpuset_update_flag(cpuset_flagbits_t bit, struct cpuset *cs,
rebuild_sched_domains_locked();
}
- if (spread_flag_changed)
+ if (spread_page_changed)
cpuset1_update_tasks_flags(cs);
out:
free_cpuset(trialcs);
@@ -4462,14 +4461,10 @@ void cpuset_nodes_allowed(struct cgroup *cgroup, nodemask_t *mask)
* cpuset_spread_node() - On which node to begin search for a page
* @rotor: round robin rotor
*
- * If a task is marked PF_SPREAD_PAGE or PF_SPREAD_SLAB (as for
- * tasks in a cpuset with is_spread_page or is_spread_slab set),
- * and if the memory allocation used cpuset_mem_spread_node()
- * to determine on which node to start looking, as it will for
- * certain page cache or slab cache pages such as used for file
- * system buffers and inode caches, then instead of starting on the
- * local node to look for a free page, rather spread the starting
- * node around the tasks mems_allowed nodes.
+ * If a task is marked PFA_SPREAD_PAGE and a page cache allocation uses
+ * cpuset_mem_spread_node() to determine where to start looking, spread the
+ * starting node around the task's mems_allowed nodes instead of starting on
+ * the local node.
*
* We don't have to worry about the returned node being offline
* because "it can't happen", and even if it did, it would be ok.