[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240506133643.1124102-1-xiujianfeng@huawei.com>
Date: Mon, 6 May 2024 13:36:43 +0000
From: Xiu Jianfeng <xiujianfeng@...wei.com>
To: <hannes@...xchg.org>, <mhocko@...nel.org>, <roman.gushchin@...ux.dev>,
<shakeel.butt@...ux.dev>, <muchun.song@...ux.dev>,
<akpm@...ux-foundation.org>
CC: <cgroups@...r.kernel.org>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH -next] mm: memcg: use meaningful error code for return value
alloc_mem_cgroup_per_node_info() returns 1 if failed, use -ENOMEM
instead, which is more meaningful.
Signed-off-by: Xiu Jianfeng <xiujianfeng@...wei.com>
---
mm/memcontrol.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index d11536ef59ef..657f68b536c4 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5659,7 +5659,7 @@ static int alloc_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node)
pn = kzalloc_node(sizeof(*pn), GFP_KERNEL, node);
if (!pn)
- return 1;
+ return -ENOMEM;
pn->lruvec_stats = kzalloc_node(sizeof(struct lruvec_stats), GFP_KERNEL,
node);
@@ -5679,7 +5679,7 @@ static int alloc_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node)
fail:
kfree(pn->lruvec_stats);
kfree(pn);
- return 1;
+ return -ENOMEM;
}
static void free_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node)
--
2.34.1
Powered by blists - more mailing lists