Skip to content

Commit a8248bb

Browse files
Xiu Jianfengakpm00
authored andcommitted
mm: memcg: make alloc_mem_cgroup_per_node_info() return bool
alloc_mem_cgroup_per_node_info() returns int that doesn't map to any errno error code. The only existing caller doesn't really need an error code so change the function to return bool (true on success) because this is slightly less confusing and more consistent with the other code. Link: https://lkml.kernel.org/r/20240507132324.1158510-1-xiujianfeng@huawei.com Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com> Acked-by: Michal Hocko <mhocko@suse.com> Acked-by: Shakeel Butt <shakeel.butt@linux.dev> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Cc: Muchun Song <muchun.song@linux.dev> Cc: Roman Gushchin <roman.gushchin@linux.dev> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 3b15f9d commit a8248bb

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

mm/memcontrol.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5637,13 +5637,13 @@ struct mem_cgroup *mem_cgroup_get_from_ino(unsigned long ino)
56375637
}
56385638
#endif
56395639

5640-
static int alloc_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node)
5640+
static bool alloc_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node)
56415641
{
56425642
struct mem_cgroup_per_node *pn;
56435643

56445644
pn = kzalloc_node(sizeof(*pn), GFP_KERNEL, node);
56455645
if (!pn)
5646-
return 1;
5646+
return false;
56475647

56485648
pn->lruvec_stats = kzalloc_node(sizeof(struct lruvec_stats),
56495649
GFP_KERNEL_ACCOUNT, node);
@@ -5659,11 +5659,11 @@ static int alloc_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node)
56595659
pn->memcg = memcg;
56605660

56615661
memcg->nodeinfo[node] = pn;
5662-
return 0;
5662+
return true;
56635663
fail:
56645664
kfree(pn->lruvec_stats);
56655665
kfree(pn);
5666-
return 1;
5666+
return false;
56675667
}
56685668

56695669
static void free_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node)
@@ -5736,7 +5736,7 @@ static struct mem_cgroup *mem_cgroup_alloc(struct mem_cgroup *parent)
57365736
}
57375737

57385738
for_each_node(node)
5739-
if (alloc_mem_cgroup_per_node_info(memcg, node))
5739+
if (!alloc_mem_cgroup_per_node_info(memcg, node))
57405740
goto fail;
57415741

57425742
if (memcg_wb_domain_init(memcg, GFP_KERNEL))

0 commit comments

Comments
 (0)