From patchwork Tue May 7 11:08:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiu Jianfeng X-Patchwork-Id: 13656688 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFA3FC25B4F for ; Tue, 7 May 2024 11:15:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3A70D6B00A3; Tue, 7 May 2024 07:15:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3575E6B00A4; Tue, 7 May 2024 07:15:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 220036B00A6; Tue, 7 May 2024 07:15:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 06C656B00A3 for ; Tue, 7 May 2024 07:15:35 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 77C0341342 for ; Tue, 7 May 2024 11:15:34 +0000 (UTC) X-FDA: 82091344188.02.9353D31 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf14.hostedemail.com (Postfix) with ESMTP id 3865A100010 for ; Tue, 7 May 2024 11:15:30 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf14.hostedemail.com: domain of xiujianfeng@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=xiujianfeng@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1715080532; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=gHDCteathS7tgD38CYMnmQG0o9h+erkrnQV5h+TtSbE=; b=vq0IyBmOQC8+qyjAiBCJgKMA+lVfFzBRhMg4VXg2fDymwuihkY9KuJ2O3hdb3Dov2kmfaV zaDLOScwlOOLjH+OYbOsnNcwkFWlYjNlQowbjlrScAvludGqsMEH1HbxulS3hIP0r1A3tb vmjGtaa5KCkYShzo8/jiTzyGk0y8JpM= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf14.hostedemail.com: domain of xiujianfeng@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=xiujianfeng@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715080532; a=rsa-sha256; cv=none; b=XJm8IiP7Ni5xqMVDW7GAaXD6z2egyhLKtWsVXB8auxw+BOjTAYkjM31lmMDgg7o3IY0wIr CPfA6h5v3Zw0xHJ28oK26X03Kt4jWYS0wWjkeH5JCOzhvrI6PxBPivi/PvAWRadNuGaut7 YpIEEHrbuTS1HEJGFEatoObzxbPjvbM= Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4VYbFN0mvtzYnhR; Tue, 7 May 2024 19:11:36 +0800 (CST) Received: from dggpeml500023.china.huawei.com (unknown [7.185.36.114]) by mail.maildlp.com (Postfix) with ESMTPS id 59357180065; Tue, 7 May 2024 19:15:25 +0800 (CST) Received: from hulk-vt.huawei.com (10.67.174.26) by dggpeml500023.china.huawei.com (7.185.36.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 7 May 2024 19:15:25 +0800 From: Xiu Jianfeng To: , , , , , CC: , , Subject: [PATCH v2 -next] mm: memcg: make alloc_mem_cgroup_per_node_info() return bool Date: Tue, 7 May 2024 11:08:32 +0000 Message-ID: <20240507110832.1128370-1-xiujianfeng@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.67.174.26] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpeml500023.china.huawei.com (7.185.36.114) X-Stat-Signature: 3pq5bzoimm3qmbeoi3hqbcrgxq39imtt X-Rspamd-Queue-Id: 3865A100010 X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1715080530-524883 X-HE-Meta: U2FsdGVkX18oqgGEt6J2fBK/174uui6Ca/jb4t5rH3LeMRa1Xziw9Ca0Zx7/qqSsPTxmi0rSDZlWJwIaMCz4N9bLNtjTeEdpdDSjLvekTsA35XXrj7elnez4rnn3fhiC0+Xiz7pBngrLkM3jJ/8prgHCoxglLsls9Ey0tIPMe0WMmoyBy8Ah5dpx7Awks18Ne4eqyhbk1pRFjNmig0Cg8JI6rJeTe8wVV5VXFy0E6ZSXXj5Jk9U5F4X4PbzV1hTBcveCh+hfU8woNAAFmcR/SmtRXEspP7eBzRMK0enu8QWfdse0mDVeKIsHtdGFPMMFqeoa6b1R+/G0wHiaQYfXoT2G6j2oekurQ62F5Vys7KrymMwPPg8wjIiJraRBIxP7ZuXDrAoL1pfMlmCDTDQYj4PKVPGTWvxUbhIdgBCNGVqRFS6i+iK0AmSgzaNhI45d0svyCBfG5d/6VJxRxiQPLBjyhr8nxdLqVzrFglGSesrKQstRfiVf564S5xOE9N1Vx+54uWQNWpvwQAyBhMZNL38/twhX7SL4qjH+gGGIZ9TlLzBYsajHueKWCjDzpwPVq46ZivJKJdUD0RcB7vJStdJCu35XZYepuwqTsE4B4D5+/6lerdKVXWF8GIJ1XFSkfMVSGKrkMSyjFjX539cvntgBu0EeLtLfaQqtDs4pD7fZFbI/FhjrsAT2rBz19DkrdZ+3Rdzshs5xysgtvOMKxezCRxaoWqO+sD69X+8r43ll0xkDVOi862Fd+crNjR3BWG0Ivn5Oib4b5Mw7k79/HFB7SkMEGOkdCQkaixC78gldgOrrCGIIJmMuZIwEfB0krjZzTiuTNd1t1ziijudxg6Dc0QQsRVAc7U6gLQskI54VvYMpWveyzOuxM0ZDGiVwEqbDoQUHK5/ahaQhXcjJaCu9RykQZvrvDh13wAV3ILQElBRv0n295UKgLR4uacGeMoX7MprD/aSTmMVJfwR P/qzFABt GoZQyzeYv3W/bNbDBG7FG8OhY0Rqq7UDhIyd6iIwM/73/bRtinewGEEd2QS3pf5cfL3OGp6PzgTjDrPOjHGW6ZyE4FqN79vmv7HvqnE9vnOr+Dzj3zR1YiHQ/i4HQdKDyWRE5MH7nz9nzwan0Sg21mOSqxJIPXOCN5pdU/BZ5/ms+1SpVpOAz0EmPia+t/NnVyBLk X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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 Acked-by: Michal Hocko Reviewed-by: Roman Gushchin Acked-by: Johannes Weiner --- 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))