From: Xiu Jianfeng <xiujianfeng@huawei.com>
To: <hannes@cmpxchg.org>, <mhocko@kernel.org>,
<roman.gushchin@linux.dev>, <shakeel.butt@linux.dev>,
<muchun.song@linux.dev>, <akpm@linux-foundation.org>
Cc: <cgroups@vger.kernel.org>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH -next] mm: memcg: use meaningful error code for return value
Date: Mon, 6 May 2024 13:36:43 +0000 [thread overview]
Message-ID: <20240506133643.1124102-1-xiujianfeng@huawei.com> (raw)
alloc_mem_cgroup_per_node_info() returns 1 if failed, use -ENOMEM
instead, which is more meaningful.
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.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
next reply other threads:[~2024-05-06 13:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-06 13:36 Xiu Jianfeng [this message]
2024-05-06 13:53 ` [PATCH -next] mm: memcg: use meaningful error code for return value Matthew Wilcox
2024-05-06 14:49 ` Michal Hocko
2024-05-07 11:17 ` xiujianfeng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240506133643.1124102-1-xiujianfeng@huawei.com \
--to=xiujianfeng@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=shakeel.butt@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).