Commit a8248bb7 authored by Xiu Jianfeng's avatar Xiu Jianfeng Committed by Andrew Morton
Browse files

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: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
Acked-by: default avatarMichal Hocko <mhocko@suse.com>
Acked-by: default avatarShakeel Butt <shakeel.butt@linux.dev>
Acked-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 3b15f9d1
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -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))