aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiu Jianfeng <[email protected]>2024-05-07 13:23:24 +0000
committerAndrew Morton <[email protected]>2024-05-11 15:41:36 -0700
commita8248bb72fed5888bc3a0c7a4c97eb358906d7ea (patch)
tree17825903adfa7a6a18be9dde1bfc8f6ed4413def
parent3b15f9d1c22dfe82efd03cb7acc2eeb557c735b5 (diff)
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/[email protected] Signed-off-by: Xiu Jianfeng <[email protected]> Acked-by: Michal Hocko <[email protected]> Acked-by: Shakeel Butt <[email protected]> Acked-by: Johannes Weiner <[email protected]> Cc: Muchun Song <[email protected]> Cc: Roman Gushchin <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
-rw-r--r--mm/memcontrol.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 2103ae77cf8d..eef02a59b8c9 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5637,13 +5637,13 @@ struct mem_cgroup *mem_cgroup_get_from_ino(unsigned long ino)
}
#endif
-static int alloc_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node)
+static bool alloc_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node)
{
struct mem_cgroup_per_node *pn;
pn = kzalloc_node(sizeof(*pn), GFP_KERNEL, node);
if (!pn)
- return 1;
+ return false;
pn->lruvec_stats = kzalloc_node(sizeof(struct lruvec_stats),
GFP_KERNEL_ACCOUNT, node);
@@ -5659,11 +5659,11 @@ static int alloc_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node)
pn->memcg = memcg;
memcg->nodeinfo[node] = pn;
- return 0;
+ return true;
fail:
kfree(pn->lruvec_stats);
kfree(pn);
- return 1;
+ return false;
}
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)
}
for_each_node(node)
- if (alloc_mem_cgroup_per_node_info(memcg, node))
+ if (!alloc_mem_cgroup_per_node_info(memcg, node))
goto fail;
if (memcg_wb_domain_init(memcg, GFP_KERNEL))