lkml.org 
[lkml]   [2024]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 -next] mm: memcg: make alloc_mem_cgroup_per_node_info() return bool
Date
Currently alloc_mem_cgroup_per_node_info() returns 1 if failed,
make it return bool, false for failure and true for success.

Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
---
mm/memcontrol.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index d11536ef59ef..69d70feb8e68 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -5653,13 +5653,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,
node);
@@ -5675,11 +5675,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)
@@ -5751,7 +5751,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))
--
2.34.1

\
 
 \ /
  Last update: 2024-05-27 18:19    [W:0.083 / U:0.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site