summaryrefslogtreecommitdiff
path: root/mm
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 /mm
parente19e1b480ac73c3e62ffebbca1174f0f511f43e7 (diff)
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 'mm')
-rw-r--r--mm/cma_debug.c2
-rw-r--r--mm/cma_sysfs.c2
-rw-r--r--mm/damon/core.c10
-rw-r--r--mm/damon/sysfs-common.c2
-rw-r--r--mm/damon/sysfs-schemes.c22
-rw-r--r--mm/damon/sysfs.c24
-rw-r--r--mm/dmapool_test.c2
-rw-r--r--mm/huge_memory.c2
-rw-r--r--mm/hugetlb.c14
-rw-r--r--mm/hugetlb_cgroup.c4
-rw-r--r--mm/kasan/kasan_test_c.c12
-rw-r--r--mm/khugepaged.c2
-rw-r--r--mm/kmsan/kmsan_test.c8
-rw-r--r--mm/list_lru.c2
-rw-r--r--mm/memcontrol.c2
-rw-r--r--mm/memfd_luo.c2
-rw-r--r--mm/memory-tiers.c4
-rw-r--r--mm/memory.c2
-rw-r--r--mm/mempolicy.c2
-rw-r--r--mm/mempool.c2
-rw-r--r--mm/page_reporting.c2
-rw-r--r--mm/shmem.c2
-rw-r--r--mm/shrinker.c2
-rw-r--r--mm/slub.c4
-rw-r--r--mm/swapfile.c6
-rw-r--r--mm/vmalloc.c6
-rw-r--r--mm/vmpressure.c2
-rw-r--r--mm/zsmalloc.c4
-rw-r--r--mm/zswap.c4
29 files changed, 77 insertions, 77 deletions
diff --git a/mm/cma_debug.c b/mm/cma_debug.c
index cb94f897169d..5ae38f5abbcc 100644
--- a/mm/cma_debug.c
+++ b/mm/cma_debug.c
@@ -131,7 +131,7 @@ static int cma_alloc_mem(struct cma *cma, int count)
struct cma_mem *mem;
struct page *p;
- mem = kzalloc_obj(*mem, GFP_KERNEL);
+ mem = kzalloc_obj(*mem);
if (!mem)
return -ENOMEM;
diff --git a/mm/cma_sysfs.c b/mm/cma_sysfs.c
index ee76baaf843c..f52b696bc46d 100644
--- a/mm/cma_sysfs.c
+++ b/mm/cma_sysfs.c
@@ -117,7 +117,7 @@ static int __init cma_sysfs_init(void)
return -ENOMEM;
for (i = 0; i < cma_area_count; i++) {
- cma_kobj = kzalloc_obj(*cma_kobj, GFP_KERNEL);
+ cma_kobj = kzalloc_obj(*cma_kobj);
if (!cma_kobj) {
err = -ENOMEM;
goto out;
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 2d73d7effa3b..01eba1a547d4 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -273,7 +273,7 @@ struct damos_filter *damos_new_filter(enum damos_filter_type type,
{
struct damos_filter *filter;
- filter = kmalloc_obj(*filter, GFP_KERNEL);
+ filter = kmalloc_obj(*filter);
if (!filter)
return NULL;
filter->type = type;
@@ -332,7 +332,7 @@ struct damos_quota_goal *damos_new_quota_goal(
{
struct damos_quota_goal *goal;
- goal = kmalloc_obj(*goal, GFP_KERNEL);
+ goal = kmalloc_obj(*goal);
if (!goal)
return NULL;
goal->metric = metric;
@@ -385,7 +385,7 @@ struct damos *damon_new_scheme(struct damos_access_pattern *pattern,
{
struct damos *scheme;
- scheme = kmalloc_obj(*scheme, GFP_KERNEL);
+ scheme = kmalloc_obj(*scheme);
if (!scheme)
return NULL;
scheme->pattern = *pattern;
@@ -473,7 +473,7 @@ struct damon_target *damon_new_target(void)
{
struct damon_target *t;
- t = kmalloc_obj(*t, GFP_KERNEL);
+ t = kmalloc_obj(*t);
if (!t)
return NULL;
@@ -529,7 +529,7 @@ struct damon_ctx *damon_new_ctx(void)
{
struct damon_ctx *ctx;
- ctx = kzalloc_obj(*ctx, GFP_KERNEL);
+ ctx = kzalloc_obj(*ctx);
if (!ctx)
return NULL;
diff --git a/mm/damon/sysfs-common.c b/mm/damon/sysfs-common.c
index 2149008135ef..83e24a9b5a0d 100644
--- a/mm/damon/sysfs-common.c
+++ b/mm/damon/sysfs-common.c
@@ -19,7 +19,7 @@ struct damon_sysfs_ul_range *damon_sysfs_ul_range_alloc(
unsigned long min,
unsigned long max)
{
- struct damon_sysfs_ul_range *range = kmalloc_obj(*range, GFP_KERNEL);
+ struct damon_sysfs_ul_range *range = kmalloc_obj(*range);
if (!range)
return NULL;
diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c
index ba700da545af..5a12d1103d33 100644
--- a/mm/damon/sysfs-schemes.c
+++ b/mm/damon/sysfs-schemes.c
@@ -210,7 +210,7 @@ struct damon_sysfs_stats {
static struct damon_sysfs_stats *damon_sysfs_stats_alloc(void)
{
- return kzalloc_obj(struct damon_sysfs_stats, GFP_KERNEL);
+ return kzalloc_obj(struct damon_sysfs_stats);
}
static ssize_t nr_tried_show(struct kobject *kobj, struct kobj_attribute *attr,
@@ -376,7 +376,7 @@ static struct damon_sysfs_scheme_filter *damon_sysfs_scheme_filter_alloc(
{
struct damon_sysfs_scheme_filter *filter;
- filter = kzalloc_obj(struct damon_sysfs_scheme_filter, GFP_KERNEL);
+ filter = kzalloc_obj(struct damon_sysfs_scheme_filter);
if (filter)
filter->handle_layer = layer;
return filter;
@@ -724,7 +724,7 @@ damon_sysfs_scheme_filters_alloc(enum damos_sysfs_filter_handle_layer layer)
{
struct damon_sysfs_scheme_filters *filters;
- filters = kzalloc_obj(struct damon_sysfs_scheme_filters, GFP_KERNEL);
+ filters = kzalloc_obj(struct damon_sysfs_scheme_filters);
if (filters)
filters->handle_layer = layer;
return filters;
@@ -1045,7 +1045,7 @@ struct damos_sysfs_quota_goal {
static struct damos_sysfs_quota_goal *damos_sysfs_quota_goal_alloc(void)
{
- return kzalloc_obj(struct damos_sysfs_quota_goal, GFP_KERNEL);
+ return kzalloc_obj(struct damos_sysfs_quota_goal);
}
struct damos_sysfs_qgoal_metric_name {
@@ -1263,7 +1263,7 @@ struct damos_sysfs_quota_goals {
static struct damos_sysfs_quota_goals *damos_sysfs_quota_goals_alloc(void)
{
- return kzalloc_obj(struct damos_sysfs_quota_goals, GFP_KERNEL);
+ return kzalloc_obj(struct damos_sysfs_quota_goals);
}
static void damos_sysfs_quota_goals_rm_dirs(
@@ -1383,7 +1383,7 @@ struct damon_sysfs_weights {
static struct damon_sysfs_weights *damon_sysfs_weights_alloc(unsigned int sz,
unsigned int nr_accesses, unsigned int age)
{
- struct damon_sysfs_weights *weights = kmalloc_obj(*weights, GFP_KERNEL);
+ struct damon_sysfs_weights *weights = kmalloc_obj(*weights);
if (!weights)
return NULL;
@@ -1495,7 +1495,7 @@ struct damon_sysfs_quotas {
static struct damon_sysfs_quotas *damon_sysfs_quotas_alloc(void)
{
- return kzalloc_obj(struct damon_sysfs_quotas, GFP_KERNEL);
+ return kzalloc_obj(struct damon_sysfs_quotas);
}
static int damon_sysfs_quotas_add_dirs(struct damon_sysfs_quotas *quotas)
@@ -1756,7 +1756,7 @@ struct damos_sysfs_dest {
static struct damos_sysfs_dest *damos_sysfs_dest_alloc(void)
{
- return kzalloc_obj(struct damos_sysfs_dest, GFP_KERNEL);
+ return kzalloc_obj(struct damos_sysfs_dest);
}
static ssize_t id_show(
@@ -1836,7 +1836,7 @@ struct damos_sysfs_dests {
static struct damos_sysfs_dests *
damos_sysfs_dests_alloc(void)
{
- return kzalloc_obj(struct damos_sysfs_dests, GFP_KERNEL);
+ return kzalloc_obj(struct damos_sysfs_dests);
}
static void damos_sysfs_dests_rm_dirs(
@@ -2013,7 +2013,7 @@ static struct damos_sysfs_action_name damos_sysfs_action_names[] = {
static struct damon_sysfs_scheme *damon_sysfs_scheme_alloc(
enum damos_action action, unsigned long apply_interval_us)
{
- struct damon_sysfs_scheme *scheme = kmalloc_obj(*scheme, GFP_KERNEL);
+ struct damon_sysfs_scheme *scheme = kmalloc_obj(*scheme);
if (!scheme)
return NULL;
@@ -2374,7 +2374,7 @@ static const struct kobj_type damon_sysfs_scheme_ktype = {
struct damon_sysfs_schemes *damon_sysfs_schemes_alloc(void)
{
- return kzalloc_obj(struct damon_sysfs_schemes, GFP_KERNEL);
+ return kzalloc_obj(struct damon_sysfs_schemes);
}
void damon_sysfs_schemes_rm_dirs(struct damon_sysfs_schemes *schemes)
diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index 9561ad8b7852..f2e7551eea3f 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -22,7 +22,7 @@ struct damon_sysfs_region {
static struct damon_sysfs_region *damon_sysfs_region_alloc(void)
{
- return kzalloc_obj(struct damon_sysfs_region, GFP_KERNEL);
+ return kzalloc_obj(struct damon_sysfs_region);
}
static ssize_t start_show(struct kobject *kobj, struct kobj_attribute *attr,
@@ -99,7 +99,7 @@ struct damon_sysfs_regions {
static struct damon_sysfs_regions *damon_sysfs_regions_alloc(void)
{
- return kzalloc_obj(struct damon_sysfs_regions, GFP_KERNEL);
+ return kzalloc_obj(struct damon_sysfs_regions);
}
static void damon_sysfs_regions_rm_dirs(struct damon_sysfs_regions *regions)
@@ -217,7 +217,7 @@ struct damon_sysfs_target {
static struct damon_sysfs_target *damon_sysfs_target_alloc(void)
{
- return kzalloc_obj(struct damon_sysfs_target, GFP_KERNEL);
+ return kzalloc_obj(struct damon_sysfs_target);
}
static int damon_sysfs_target_add_dirs(struct damon_sysfs_target *target)
@@ -323,7 +323,7 @@ struct damon_sysfs_targets {
static struct damon_sysfs_targets *damon_sysfs_targets_alloc(void)
{
- return kzalloc_obj(struct damon_sysfs_targets, GFP_KERNEL);
+ return kzalloc_obj(struct damon_sysfs_targets);
}
static void damon_sysfs_targets_rm_dirs(struct damon_sysfs_targets *targets)
@@ -452,7 +452,7 @@ static struct damon_sysfs_intervals_goal *damon_sysfs_intervals_goal_alloc(
unsigned long access_bp, unsigned long aggrs,
unsigned long min_sample_us, unsigned long max_sample_us)
{
- struct damon_sysfs_intervals_goal *goal = kmalloc_obj(*goal, GFP_KERNEL);
+ struct damon_sysfs_intervals_goal *goal = kmalloc_obj(*goal);
if (!goal)
return NULL;
@@ -760,7 +760,7 @@ struct damon_sysfs_attrs {
static struct damon_sysfs_attrs *damon_sysfs_attrs_alloc(void)
{
- struct damon_sysfs_attrs *attrs = kmalloc_obj(*attrs, GFP_KERNEL);
+ struct damon_sysfs_attrs *attrs = kmalloc_obj(*attrs);
if (!attrs)
return NULL;
@@ -872,7 +872,7 @@ struct damon_sysfs_context {
static struct damon_sysfs_context *damon_sysfs_context_alloc(
enum damon_ops_id ops_id)
{
- struct damon_sysfs_context *context = kmalloc_obj(*context, GFP_KERNEL);
+ struct damon_sysfs_context *context = kmalloc_obj(*context);
if (!context)
return NULL;
@@ -1094,7 +1094,7 @@ struct damon_sysfs_contexts {
static struct damon_sysfs_contexts *damon_sysfs_contexts_alloc(void)
{
- return kzalloc_obj(struct damon_sysfs_contexts, GFP_KERNEL);
+ return kzalloc_obj(struct damon_sysfs_contexts);
}
static void damon_sysfs_contexts_rm_dirs(struct damon_sysfs_contexts *contexts)
@@ -1221,7 +1221,7 @@ struct damon_sysfs_kdamond {
static struct damon_sysfs_kdamond *damon_sysfs_kdamond_alloc(void)
{
- return kzalloc_obj(struct damon_sysfs_kdamond, GFP_KERNEL);
+ return kzalloc_obj(struct damon_sysfs_kdamond);
}
static int damon_sysfs_kdamond_add_dirs(struct damon_sysfs_kdamond *kdamond)
@@ -1642,7 +1642,7 @@ static int damon_sysfs_turn_damon_on(struct damon_sysfs_kdamond *kdamond)
damon_destroy_ctx(kdamond->damon_ctx);
kdamond->damon_ctx = NULL;
- repeat_call_control = kmalloc_obj(*repeat_call_control, GFP_KERNEL);
+ repeat_call_control = kmalloc_obj(*repeat_call_control);
if (!repeat_call_control)
return -ENOMEM;
@@ -1895,7 +1895,7 @@ struct damon_sysfs_kdamonds {
static struct damon_sysfs_kdamonds *damon_sysfs_kdamonds_alloc(void)
{
- return kzalloc_obj(struct damon_sysfs_kdamonds, GFP_KERNEL);
+ return kzalloc_obj(struct damon_sysfs_kdamonds);
}
static void damon_sysfs_kdamonds_rm_dirs(struct damon_sysfs_kdamonds *kdamonds)
@@ -2036,7 +2036,7 @@ struct damon_sysfs_ui_dir {
static struct damon_sysfs_ui_dir *damon_sysfs_ui_dir_alloc(void)
{
- return kzalloc_obj(struct damon_sysfs_ui_dir, GFP_KERNEL);
+ return kzalloc_obj(struct damon_sysfs_ui_dir);
}
static int damon_sysfs_ui_dir_add_dirs(struct damon_sysfs_ui_dir *ui_dir)
diff --git a/mm/dmapool_test.c b/mm/dmapool_test.c
index 454952ac9f0e..d829d99aa194 100644
--- a/mm/dmapool_test.c
+++ b/mm/dmapool_test.c
@@ -67,7 +67,7 @@ static int dmapool_test_block(const struct dmapool_parms *parms)
struct dma_pool_pair *p;
int i, ret;
- p = kzalloc_objs(*p, blocks, GFP_KERNEL);
+ p = kzalloc_objs(*p, blocks);
if (!p)
return -ENOMEM;
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 809c99ee81b9..d4ca8cfd7f9d 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -718,7 +718,7 @@ static struct thpsize *thpsize_create(int order, struct kobject *parent)
struct thpsize *thpsize;
int ret = -ENOMEM;
- thpsize = kzalloc_obj(*thpsize, GFP_KERNEL);
+ thpsize = kzalloc_obj(*thpsize);
if (!thpsize)
goto err;
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 6793a5b07882..0beb6e22bc26 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -154,7 +154,7 @@ struct hugepage_subpool *hugepage_new_subpool(struct hstate *h, long max_hpages,
{
struct hugepage_subpool *spool;
- spool = kzalloc_obj(*spool, GFP_KERNEL);
+ spool = kzalloc_obj(*spool);
if (!spool)
return NULL;
@@ -429,7 +429,7 @@ int hugetlb_vma_lock_alloc(struct vm_area_struct *vma)
if (vma->vm_private_data)
return -EINVAL;
- vma_lock = kmalloc_obj(*vma_lock, GFP_KERNEL);
+ vma_lock = kmalloc_obj(*vma_lock);
if (!vma_lock) {
/*
* If we can not allocate structure, then vma can not
@@ -687,7 +687,7 @@ static int allocate_file_region_entries(struct resv_map *resv,
spin_unlock(&resv->lock);
for (i = 0; i < to_allocate; i++) {
- trg = kmalloc_obj(*trg, GFP_KERNEL);
+ trg = kmalloc_obj(*trg);
if (!trg)
goto out_of_memory;
list_add(&trg->link, &allocated_regions);
@@ -891,7 +891,7 @@ retry:
if (!nrg) {
spin_unlock(&resv->lock);
- nrg = kmalloc_obj(*nrg, GFP_KERNEL);
+ nrg = kmalloc_obj(*nrg);
if (!nrg)
return -ENOMEM;
goto retry;
@@ -1105,8 +1105,8 @@ resv_map_set_hugetlb_cgroup_uncharge_info(struct resv_map *resv_map,
struct resv_map *resv_map_alloc(void)
{
- struct resv_map *resv_map = kmalloc_obj(*resv_map, GFP_KERNEL);
- struct file_region *rg = kmalloc_obj(*rg, GFP_KERNEL);
+ struct resv_map *resv_map = kmalloc_obj(*resv_map);
+ struct file_region *rg = kmalloc_obj(*rg);
if (!resv_map || !rg) {
kfree(resv_map);
@@ -4190,7 +4190,7 @@ static int __init hugetlb_init(void)
num_fault_mutexes = 1;
#endif
hugetlb_fault_mutex_table =
- kmalloc_objs(struct mutex, num_fault_mutexes, GFP_KERNEL);
+ kmalloc_objs(struct mutex, num_fault_mutexes);
BUG_ON(!hugetlb_fault_mutex_table);
for (i = 0; i < num_fault_mutexes; i++)
diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c
index 6e4706d6ee82..12239d5fd042 100644
--- a/mm/hugetlb_cgroup.c
+++ b/mm/hugetlb_cgroup.c
@@ -856,10 +856,10 @@ static void __init __hugetlb_cgroup_file_pre_init(void)
int cft_count;
cft_count = hugetlb_max_hstate * DFL_TMPL_SIZE + 1; /* add terminator */
- dfl_files = kzalloc_objs(struct cftype, cft_count, GFP_KERNEL);
+ dfl_files = kzalloc_objs(struct cftype, cft_count);
BUG_ON(!dfl_files);
cft_count = hugetlb_max_hstate * LEGACY_TMPL_SIZE + 1; /* add terminator */
- legacy_files = kzalloc_objs(struct cftype, cft_count, GFP_KERNEL);
+ legacy_files = kzalloc_objs(struct cftype, cft_count);
BUG_ON(!legacy_files);
}
diff --git a/mm/kasan/kasan_test_c.c b/mm/kasan/kasan_test_c.c
index cb9c95ed7821..32d06cbf6a31 100644
--- a/mm/kasan/kasan_test_c.c
+++ b/mm/kasan/kasan_test_c.c
@@ -511,7 +511,7 @@ static void kmalloc_oob_16(struct kunit *test)
ptr1 = RELOC_HIDE(kmalloc(sizeof(*ptr1) - 3, GFP_KERNEL), 0);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr1);
- ptr2 = kmalloc_obj(*ptr2, GFP_KERNEL);
+ ptr2 = kmalloc_obj(*ptr2);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2);
OPTIMIZER_HIDE_VAR(ptr1);
@@ -529,10 +529,10 @@ static void kmalloc_uaf_16(struct kunit *test)
KASAN_TEST_NEEDS_CHECKED_MEMINTRINSICS(test);
- ptr1 = kmalloc_obj(*ptr1, GFP_KERNEL);
+ ptr1 = kmalloc_obj(*ptr1);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr1);
- ptr2 = kmalloc_obj(*ptr2, GFP_KERNEL);
+ ptr2 = kmalloc_obj(*ptr2);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2);
kfree(ptr2);
@@ -859,7 +859,7 @@ static void kasan_atomics(struct kunit *test)
*/
a1 = kzalloc(48, GFP_KERNEL);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, a1);
- a2 = kzalloc_obj(atomic_long_t, GFP_KERNEL);
+ a2 = kzalloc_obj(atomic_long_t);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, a2);
/* Use atomics to access the redzone. */
@@ -954,7 +954,7 @@ static void rcu_uaf(struct kunit *test)
{
struct kasan_rcu_info *ptr;
- ptr = kmalloc_obj(struct kasan_rcu_info, GFP_KERNEL);
+ ptr = kmalloc_obj(struct kasan_rcu_info);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr);
global_rcu_ptr = rcu_dereference_protected(
@@ -978,7 +978,7 @@ static void workqueue_uaf(struct kunit *test)
workqueue = create_workqueue("kasan_workqueue_test");
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, workqueue);
- work = kmalloc_obj(struct work_struct, GFP_KERNEL);
+ work = kmalloc_obj(struct work_struct);
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, work);
INIT_WORK(work, workqueue_uaf_work);
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index f2f95b32317c..1dd3cfca610d 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -2769,7 +2769,7 @@ int madvise_collapse(struct vm_area_struct *vma, unsigned long start,
if (!thp_vma_allowable_order(vma, vma->vm_flags, TVA_FORCED_COLLAPSE, PMD_ORDER))
return -EINVAL;
- cc = kmalloc_obj(*cc, GFP_KERNEL);
+ cc = kmalloc_obj(*cc);
if (!cc)
return -ENOMEM;
cc->is_khugepaged = false;
diff --git a/mm/kmsan/kmsan_test.c b/mm/kmsan/kmsan_test.c
index 27cc936176ea..31f47cc4dab4 100644
--- a/mm/kmsan/kmsan_test.c
+++ b/mm/kmsan/kmsan_test.c
@@ -168,7 +168,7 @@ static void test_uninit_kmalloc(struct kunit *test)
int *ptr;
kunit_info(test, "uninitialized kmalloc test (UMR report)\n");
- ptr = kmalloc_obj(*ptr, GFP_KERNEL);
+ ptr = kmalloc_obj(*ptr);
USE(*ptr);
KUNIT_EXPECT_TRUE(test, report_matches(&expect));
}
@@ -182,7 +182,7 @@ static void test_init_kmalloc(struct kunit *test)
int *ptr;
kunit_info(test, "initialized kmalloc test (no reports)\n");
- ptr = kmalloc_obj(*ptr, GFP_KERNEL);
+ ptr = kmalloc_obj(*ptr);
memset(ptr, 0, sizeof(*ptr));
USE(*ptr);
KUNIT_EXPECT_TRUE(test, report_matches(&expect));
@@ -195,7 +195,7 @@ static void test_init_kzalloc(struct kunit *test)
int *ptr;
kunit_info(test, "initialized kzalloc test (no reports)\n");
- ptr = kzalloc_obj(*ptr, GFP_KERNEL);
+ ptr = kzalloc_obj(*ptr);
USE(*ptr);
KUNIT_EXPECT_TRUE(test, report_matches(&expect));
}
@@ -322,7 +322,7 @@ static void test_init_kmsan_vmap_vunmap(struct kunit *test)
kunit_info(test, "pages initialized via vmap (no reports)\n");
- pages = kmalloc_objs(*pages, npages, GFP_KERNEL);
+ pages = kmalloc_objs(*pages, npages);
for (int i = 0; i < npages; i++)
pages[i] = alloc_page(GFP_KERNEL);
vbuf = vmap(pages, npages, VM_MAP, PAGE_KERNEL);
diff --git a/mm/list_lru.c b/mm/list_lru.c
index 16526b9d71b5..26463ae29c64 100644
--- a/mm/list_lru.c
+++ b/mm/list_lru.c
@@ -585,7 +585,7 @@ int __list_lru_init(struct list_lru *lru, bool memcg_aware, struct shrinker *shr
memcg_aware = false;
#endif
- lru->node = kzalloc_objs(*lru->node, nr_node_ids, GFP_KERNEL);
+ lru->node = kzalloc_objs(*lru->node, nr_node_ids);
if (!lru->node)
return -ENOMEM;
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 63773a0b91f7..a52da3a5e4fd 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -192,7 +192,7 @@ static struct obj_cgroup *obj_cgroup_alloc(void)
struct obj_cgroup *objcg;
int ret;
- objcg = kzalloc_obj(struct obj_cgroup, GFP_KERNEL);
+ objcg = kzalloc_obj(struct obj_cgroup);
if (!objcg)
return NULL;
diff --git a/mm/memfd_luo.c b/mm/memfd_luo.c
index c69774c19c88..5c17da3880c5 100644
--- a/mm/memfd_luo.c
+++ b/mm/memfd_luo.c
@@ -112,7 +112,7 @@ static int memfd_luo_preserve_folios(struct file *file,
* up being smaller if there are higher order folios.
*/
max_folios = PAGE_ALIGN(size) / PAGE_SIZE;
- folios = kvmalloc_objs(*folios, max_folios, GFP_KERNEL);
+ folios = kvmalloc_objs(*folios, max_folios);
if (!folios)
return -ENOMEM;
diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c
index b05c916fa5f4..631df0614331 100644
--- a/mm/memory-tiers.c
+++ b/mm/memory-tiers.c
@@ -227,7 +227,7 @@ static struct memory_tier *find_create_memory_tier(struct memory_dev_type *memty
}
}
- new_memtier = kzalloc_obj(struct memory_tier, GFP_KERNEL);
+ new_memtier = kzalloc_obj(struct memory_tier);
if (!new_memtier)
return ERR_PTR(-ENOMEM);
@@ -625,7 +625,7 @@ struct memory_dev_type *alloc_memory_type(int adistance)
{
struct memory_dev_type *memtype;
- memtype = kmalloc_obj(*memtype, GFP_KERNEL);
+ memtype = kmalloc_obj(*memtype);
if (!memtype)
return ERR_PTR(-ENOMEM);
diff --git a/mm/memory.c b/mm/memory.c
index 144e30d2825f..07778814b4a8 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3035,7 +3035,7 @@ static inline struct pfnmap_track_ctx *pfnmap_track_ctx_alloc(unsigned long pfn,
if (pfnmap_track(pfn, size, prot))
return ERR_PTR(-EINVAL);
- ctx = kmalloc_obj(*ctx, GFP_KERNEL);
+ ctx = kmalloc_obj(*ctx);
if (unlikely(!ctx)) {
pfnmap_untrack(pfn, size);
return ERR_PTR(-ENOMEM);
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 0835743f6575..3b2d6b77a383 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -3815,7 +3815,7 @@ static int sysfs_wi_node_add(int nid)
return -EINVAL;
}
- new_attr = kzalloc_obj(*new_attr, GFP_KERNEL);
+ new_attr = kzalloc_obj(*new_attr);
if (!new_attr)
return -ENOMEM;
diff --git a/mm/mempool.c b/mm/mempool.c
index c22c63ccbbcd..db23e0eef652 100644
--- a/mm/mempool.c
+++ b/mm/mempool.c
@@ -371,7 +371,7 @@ int mempool_resize(struct mempool *pool, int new_min_nr)
spin_unlock_irqrestore(&pool->lock, flags);
/* Grow the pool */
- new_elements = kmalloc_objs(*new_elements, new_min_nr, GFP_KERNEL);
+ new_elements = kmalloc_objs(*new_elements, new_min_nr);
if (!new_elements)
return -ENOMEM;
diff --git a/mm/page_reporting.c b/mm/page_reporting.c
index 7323284d2f7d..f0042d5743af 100644
--- a/mm/page_reporting.c
+++ b/mm/page_reporting.c
@@ -322,7 +322,7 @@ static void page_reporting_process(struct work_struct *work)
atomic_set(&prdev->state, state);
/* allocate scatterlist to store pages being reported on */
- sgl = kmalloc_objs(*sgl, PAGE_REPORTING_CAPACITY, GFP_KERNEL);
+ sgl = kmalloc_objs(*sgl, PAGE_REPORTING_CAPACITY);
if (!sgl)
goto err_out;
diff --git a/mm/shmem.c b/mm/shmem.c
index 5f2e8e3d5b75..b40f3cd48961 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -5328,7 +5328,7 @@ int shmem_init_fs_context(struct fs_context *fc)
{
struct shmem_options *ctx;
- ctx = kzalloc_obj(struct shmem_options, GFP_KERNEL);
+ ctx = kzalloc_obj(struct shmem_options);
if (!ctx)
return -ENOMEM;
diff --git a/mm/shrinker.c b/mm/shrinker.c
index 52e7bebe4579..7b61fc0ee78f 100644
--- a/mm/shrinker.c
+++ b/mm/shrinker.c
@@ -682,7 +682,7 @@ struct shrinker *shrinker_alloc(unsigned int flags, const char *fmt, ...)
va_list ap;
int err;
- shrinker = kzalloc_obj(struct shrinker, GFP_KERNEL);
+ shrinker = kzalloc_obj(struct shrinker);
if (!shrinker)
return NULL;
diff --git a/mm/slub.c b/mm/slub.c
index b8e9c0b62435..862642c165ed 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -9139,7 +9139,7 @@ static int show_stat(struct kmem_cache *s, char *buf, enum stat_item si)
unsigned long sum = 0;
int cpu;
int len = 0;
- int *data = kmalloc_objs(int, nr_cpu_ids, GFP_KERNEL);
+ int *data = kmalloc_objs(int, nr_cpu_ids);
if (!data)
return -ENOMEM;
@@ -9510,7 +9510,7 @@ int sysfs_slab_alias(struct kmem_cache *s, const char *name)
return sysfs_create_link(&slab_kset->kobj, &s->kobj, name);
}
- al = kmalloc_obj(struct saved_alias, GFP_KERNEL);
+ al = kmalloc_obj(struct saved_alias);
if (!al)
return -ENOMEM;
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 8a1e2af356ba..a94aa1054fd8 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -2575,7 +2575,7 @@ add_swap_extent(struct swap_info_struct *sis, unsigned long start_page,
}
/* No merge, insert a new extent. */
- new_se = kmalloc_obj(*se, GFP_KERNEL);
+ new_se = kmalloc_obj(*se);
if (new_se == NULL)
return -ENOMEM;
new_se->start_page = start_page;
@@ -3048,7 +3048,7 @@ static struct swap_info_struct *alloc_swap_info(void)
struct swap_info_struct *defer = NULL;
unsigned int type;
- p = kvzalloc_obj(struct swap_info_struct, GFP_KERNEL);
+ p = kvzalloc_obj(struct swap_info_struct);
if (!p)
return ERR_PTR(-ENOMEM);
@@ -3257,7 +3257,7 @@ static struct swap_cluster_info *setup_clusters(struct swap_info_struct *si,
int err = -ENOMEM;
unsigned long i;
- cluster_info = kvzalloc_objs(*cluster_info, nr_clusters, GFP_KERNEL);
+ cluster_info = kvzalloc_objs(*cluster_info, nr_clusters);
if (!cluster_info)
goto err;
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 672c56d8bfe1..61caa55a4402 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -4920,14 +4920,14 @@ struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,
return NULL;
}
- vms = kzalloc_objs(vms[0], nr_vms, GFP_KERNEL);
- vas = kzalloc_objs(vas[0], nr_vms, GFP_KERNEL);
+ vms = kzalloc_objs(vms[0], nr_vms);
+ vas = kzalloc_objs(vas[0], nr_vms);
if (!vas || !vms)
goto err_free2;
for (area = 0; area < nr_vms; area++) {
vas[area] = kmem_cache_zalloc(vmap_area_cachep, GFP_KERNEL);
- vms[area] = kzalloc_obj(struct vm_struct, GFP_KERNEL);
+ vms[area] = kzalloc_obj(struct vm_struct);
if (!vas[area] || !vms[area])
goto err_free;
}
diff --git a/mm/vmpressure.c b/mm/vmpressure.c
index 035e0384e39b..3fbb86996c4d 100644
--- a/mm/vmpressure.c
+++ b/mm/vmpressure.c
@@ -402,7 +402,7 @@ int vmpressure_register_event(struct mem_cgroup *memcg,
mode = ret;
}
- ev = kzalloc_obj(*ev, GFP_KERNEL);
+ ev = kzalloc_obj(*ev);
if (!ev) {
ret = -ENOMEM;
goto out;
diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index fa0b726dcec7..2c1430bf8d57 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -2062,7 +2062,7 @@ struct zs_pool *zs_create_pool(const char *name)
struct zs_pool *pool;
struct size_class *prev_class = NULL;
- pool = kzalloc_obj(*pool, GFP_KERNEL);
+ pool = kzalloc_obj(*pool);
if (!pool)
return NULL;
@@ -2128,7 +2128,7 @@ struct zs_pool *zs_create_pool(const char *name)
}
}
- class = kzalloc_obj(struct size_class, GFP_KERNEL);
+ class = kzalloc_obj(struct size_class);
if (!class)
goto err;
diff --git a/mm/zswap.c b/mm/zswap.c
index bbfd8a51e4c8..e6ec3295bdb0 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -251,7 +251,7 @@ static struct zswap_pool *zswap_pool_create(char *compressor)
if (!zswap_has_pool && !strcmp(compressor, ZSWAP_PARAM_UNSET))
return NULL;
- pool = kzalloc_obj(*pool, GFP_KERNEL);
+ pool = kzalloc_obj(*pool);
if (!pool)
return NULL;
@@ -1665,7 +1665,7 @@ int zswap_swapon(int type, unsigned long nr_pages)
unsigned int nr, i;
nr = DIV_ROUND_UP(nr_pages, ZSWAP_ADDRESS_SPACE_PAGES);
- trees = kvzalloc_objs(*tree, nr, GFP_KERNEL);
+ trees = kvzalloc_objs(*tree, nr);
if (!trees) {
pr_err("alloc failed, zswap disabled for swap type %d\n", type);
return -ENOMEM;