summaryrefslogtreecommitdiff
path: root/kernel/cgroup
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-02-21 16:37:42 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2026-02-21 17:09:51 -0800
commitbf4afc53b77aeaa48b5409da5c8da6bb4eff7f43 (patch)
tree01fdd9d27f1b272bef0127966e08eac44d134d0a /kernel/cgroup
parente19e1b480ac73c3e62ffebbca1174f0f511f43e7 (diff)
downloadlwn-bf4afc53b77aeaa48b5409da5c8da6bb4eff7f43.tar.gz
lwn-bf4afc53b77aeaa48b5409da5c8da6bb4eff7f43.zip
Convert 'alloc_obj' family to use the new default GFP_KERNEL argument
This was done entirely with mindless brute force, using git grep -l '\<k[vmz]*alloc_objs*(.*, GFP_KERNEL)' | xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/' to convert the new alloc_obj() users that had a simple GFP_KERNEL argument to just drop that argument. Note that due to the extreme simplicity of the scripting, any slightly more complex cases spread over multiple lines would not be triggered: they definitely exist, but this covers the vast bulk of the cases, and the resulting diff is also then easier to check automatically. For the same reason the 'flex' versions will be done as a separate conversion. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/cgroup')
-rw-r--r--kernel/cgroup/cgroup-v1.c6
-rw-r--r--kernel/cgroup/cgroup.c8
-rw-r--r--kernel/cgroup/cpuset-v1.c8
-rw-r--r--kernel/cgroup/cpuset.c10
-rw-r--r--kernel/cgroup/debug.c2
-rw-r--r--kernel/cgroup/dmem.c6
-rw-r--r--kernel/cgroup/legacy_freezer.c2
-rw-r--r--kernel/cgroup/misc.c2
-rw-r--r--kernel/cgroup/pids.c2
-rw-r--r--kernel/cgroup/rdma.c6
10 files changed, 26 insertions, 26 deletions
diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
index 0449b062dd1c..a4337c9b5287 100644
--- a/kernel/cgroup/cgroup-v1.c
+++ b/kernel/cgroup/cgroup-v1.c
@@ -317,7 +317,7 @@ static struct cgroup_pidlist *cgroup_pidlist_find_create(struct cgroup *cgrp,
return l;
/* entry not found; create a new one */
- l = kzalloc_obj(struct cgroup_pidlist, GFP_KERNEL);
+ l = kzalloc_obj(struct cgroup_pidlist);
if (!l)
return l;
@@ -352,7 +352,7 @@ static int pidlist_array_load(struct cgroup *cgrp, enum cgroup_filetype type,
* show up until sometime later on.
*/
length = cgroup_task_count(cgrp);
- array = kvmalloc_objs(pid_t, length, GFP_KERNEL);
+ array = kvmalloc_objs(pid_t, length);
if (!array)
return -ENOMEM;
/* now, populate the array */
@@ -1237,7 +1237,7 @@ static int cgroup1_root_to_use(struct fs_context *fc)
if (ctx->ns != &init_cgroup_ns)
return -EPERM;
- root = kzalloc_obj(*root, GFP_KERNEL);
+ root = kzalloc_obj(*root);
if (!root)
return -ENOMEM;
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 7d220276d019..c14fbdc4cdbe 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -1168,7 +1168,7 @@ static int allocate_cgrp_cset_links(int count, struct list_head *tmp_links)
INIT_LIST_HEAD(tmp_links);
for (i = 0; i < count; i++) {
- link = kzalloc_obj(*link, GFP_KERNEL);
+ link = kzalloc_obj(*link);
if (!link) {
free_cgrp_cset_links(tmp_links);
return -ENOMEM;
@@ -1241,7 +1241,7 @@ static struct css_set *find_css_set(struct css_set *old_cset,
if (cset)
return cset;
- cset = kzalloc_obj(*cset, GFP_KERNEL);
+ cset = kzalloc_obj(*cset);
if (!cset)
return NULL;
@@ -2350,7 +2350,7 @@ static int cgroup_init_fs_context(struct fs_context *fc)
{
struct cgroup_fs_context *ctx;
- ctx = kzalloc_obj(struct cgroup_fs_context, GFP_KERNEL);
+ ctx = kzalloc_obj(struct cgroup_fs_context);
if (!ctx)
return -ENOMEM;
@@ -4251,7 +4251,7 @@ static int cgroup_file_open(struct kernfs_open_file *of)
struct cgroup_file_ctx *ctx;
int ret;
- ctx = kzalloc_obj(*ctx, GFP_KERNEL);
+ ctx = kzalloc_obj(*ctx);
if (!ctx)
return -ENOMEM;
diff --git a/kernel/cgroup/cpuset-v1.c b/kernel/cgroup/cpuset-v1.c
index 8e7ffc205c3b..7308e9b02495 100644
--- a/kernel/cgroup/cpuset-v1.c
+++ b/kernel/cgroup/cpuset-v1.c
@@ -316,7 +316,7 @@ void cpuset1_hotplug_update_tasks(struct cpuset *cs,
css_tryget_online(&cs->css)) {
struct cpuset_remove_tasks_struct *s;
- s = kzalloc_obj(*s, GFP_KERNEL);
+ s = kzalloc_obj(*s);
if (WARN_ON_ONCE(!s)) {
css_put(&cs->css);
return;
@@ -653,7 +653,7 @@ int cpuset1_generate_sched_domains(cpumask_var_t **domains,
if (!doms)
goto done;
- dattr = kmalloc_obj(struct sched_domain_attr, GFP_KERNEL);
+ dattr = kmalloc_obj(struct sched_domain_attr);
if (dattr) {
*dattr = SD_ATTR_INIT;
update_domain_attr_tree(dattr, &top_cpuset);
@@ -664,7 +664,7 @@ int cpuset1_generate_sched_domains(cpumask_var_t **domains,
goto done;
}
- csa = kmalloc_objs(cp, nr_cpusets(), GFP_KERNEL);
+ csa = kmalloc_objs(cp, nr_cpusets());
if (!csa)
goto done;
csn = 0;
@@ -727,7 +727,7 @@ int cpuset1_generate_sched_domains(cpumask_var_t **domains,
* The rest of the code, including the scheduler, can deal with
* dattr==NULL case. No need to abort if alloc fails.
*/
- dattr = kmalloc_objs(struct sched_domain_attr, ndoms, GFP_KERNEL);
+ dattr = kmalloc_objs(struct sched_domain_attr, ndoms);
for (nslot = 0, i = 0; i < csn; i++) {
nslot_update = 0;
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 384d9d6e323b..9faf34377a88 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -536,7 +536,7 @@ static struct cpuset *dup_or_alloc_cpuset(struct cpuset *cs)
/* Allocate base structure */
trial = cs ? kmemdup(cs, sizeof(*cs), GFP_KERNEL) :
- kzalloc_obj(*cs, GFP_KERNEL);
+ kzalloc_obj(*cs);
if (!trial)
return NULL;
@@ -791,7 +791,7 @@ static int generate_sched_domains(cpumask_var_t **domains,
goto generate_doms;
}
- csa = kmalloc_objs(cp, nr_cpusets(), GFP_KERNEL);
+ csa = kmalloc_objs(cp, nr_cpusets());
if (!csa)
goto done;
@@ -835,7 +835,7 @@ generate_doms:
* The rest of the code, including the scheduler, can deal with
* dattr==NULL case. No need to abort if alloc fails.
*/
- dattr = kmalloc_objs(struct sched_domain_attr, ndoms, GFP_KERNEL);
+ dattr = kmalloc_objs(struct sched_domain_attr, ndoms);
/*
* Cgroup v2 doesn't support domain attributes, just set all of them
@@ -2478,7 +2478,7 @@ static void cpuset_migrate_mm(struct mm_struct *mm, const nodemask_t *from,
return;
}
- mwork = kzalloc_obj(*mwork, GFP_KERNEL);
+ mwork = kzalloc_obj(*mwork);
if (mwork) {
mwork->mm = mm;
mwork->from = *from;
@@ -2500,7 +2500,7 @@ static void schedule_flush_migrate_mm(void)
{
struct callback_head *flush_cb;
- flush_cb = kzalloc_obj(struct callback_head, GFP_KERNEL);
+ flush_cb = kzalloc_obj(struct callback_head);
if (!flush_cb)
return;
diff --git a/kernel/cgroup/debug.c b/kernel/cgroup/debug.c
index 78429dd9e9c6..883347b87842 100644
--- a/kernel/cgroup/debug.c
+++ b/kernel/cgroup/debug.c
@@ -14,7 +14,7 @@
static struct cgroup_subsys_state *
debug_css_alloc(struct cgroup_subsys_state *parent_css)
{
- struct cgroup_subsys_state *css = kzalloc_obj(*css, GFP_KERNEL);
+ struct cgroup_subsys_state *css = kzalloc_obj(*css);
if (!css)
return ERR_PTR(-ENOMEM);
diff --git a/kernel/cgroup/dmem.c b/kernel/cgroup/dmem.c
index 0c8c0a135231..9d95824dc6fa 100644
--- a/kernel/cgroup/dmem.c
+++ b/kernel/cgroup/dmem.c
@@ -222,7 +222,7 @@ static void dmemcs_free(struct cgroup_subsys_state *css)
static struct cgroup_subsys_state *
dmemcs_alloc(struct cgroup_subsys_state *parent_css)
{
- struct dmemcg_state *dmemcs = kzalloc_obj(*dmemcs, GFP_KERNEL);
+ struct dmemcg_state *dmemcs = kzalloc_obj(*dmemcs);
if (!dmemcs)
return ERR_PTR(-ENOMEM);
@@ -521,7 +521,7 @@ struct dmem_cgroup_region *dmem_cgroup_register_region(u64 size, const char *fmt
if (!region_name)
return ERR_PTR(-ENOMEM);
- ret = kzalloc_obj(*ret, GFP_KERNEL);
+ ret = kzalloc_obj(*ret);
if (!ret) {
kfree(region_name);
return ERR_PTR(-ENOMEM);
@@ -597,7 +597,7 @@ get_cg_pool_unlocked(struct dmemcg_state *cg, struct dmem_cgroup_region *region)
if (WARN_ON(allocpool))
continue;
- allocpool = kzalloc_obj(*allocpool, GFP_KERNEL);
+ allocpool = kzalloc_obj(*allocpool);
if (allocpool) {
pool = NULL;
continue;
diff --git a/kernel/cgroup/legacy_freezer.c b/kernel/cgroup/legacy_freezer.c
index 85344b107873..8545e0d1ba3d 100644
--- a/kernel/cgroup/legacy_freezer.c
+++ b/kernel/cgroup/legacy_freezer.c
@@ -81,7 +81,7 @@ freezer_css_alloc(struct cgroup_subsys_state *parent_css)
{
struct freezer *freezer;
- freezer = kzalloc_obj(struct freezer, GFP_KERNEL);
+ freezer = kzalloc_obj(struct freezer);
if (!freezer)
return ERR_PTR(-ENOMEM);
diff --git a/kernel/cgroup/misc.c b/kernel/cgroup/misc.c
index 7c3ae3a76c8d..4a9e2557141c 100644
--- a/kernel/cgroup/misc.c
+++ b/kernel/cgroup/misc.c
@@ -445,7 +445,7 @@ misc_cg_alloc(struct cgroup_subsys_state *parent_css)
if (!parent_css) {
cg = &root_cg;
} else {
- cg = kzalloc_obj(*cg, GFP_KERNEL);
+ cg = kzalloc_obj(*cg);
if (!cg)
return ERR_PTR(-ENOMEM);
}
diff --git a/kernel/cgroup/pids.c b/kernel/cgroup/pids.c
index 6221573fc6ad..ecbb839d2acb 100644
--- a/kernel/cgroup/pids.c
+++ b/kernel/cgroup/pids.c
@@ -80,7 +80,7 @@ pids_css_alloc(struct cgroup_subsys_state *parent)
{
struct pids_cgroup *pids;
- pids = kzalloc_obj(struct pids_cgroup, GFP_KERNEL);
+ pids = kzalloc_obj(struct pids_cgroup);
if (!pids)
return ERR_PTR(-ENOMEM);
diff --git a/kernel/cgroup/rdma.c b/kernel/cgroup/rdma.c
index 9d3693574b11..09258eebb5c7 100644
--- a/kernel/cgroup/rdma.c
+++ b/kernel/cgroup/rdma.c
@@ -134,7 +134,7 @@ get_cg_rpool_locked(struct rdma_cgroup *cg, struct rdmacg_device *device)
if (rpool)
return rpool;
- rpool = kzalloc_obj(*rpool, GFP_KERNEL);
+ rpool = kzalloc_obj(*rpool);
if (!rpool)
return ERR_PTR(-ENOMEM);
@@ -443,7 +443,7 @@ static ssize_t rdmacg_resource_set_max(struct kernfs_open_file *of,
goto err;
}
- new_limits = kzalloc_objs(int, RDMACG_RESOURCE_MAX, GFP_KERNEL);
+ new_limits = kzalloc_objs(int, RDMACG_RESOURCE_MAX);
if (!new_limits) {
ret = -ENOMEM;
goto err;
@@ -566,7 +566,7 @@ rdmacg_css_alloc(struct cgroup_subsys_state *parent)
{
struct rdma_cgroup *cg;
- cg = kzalloc_obj(*cg, GFP_KERNEL);
+ cg = kzalloc_obj(*cg);
if (!cg)
return ERR_PTR(-ENOMEM);