Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp444266lqh; Tue, 7 May 2024 04:15:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWQOhfbGWY8PEne8SwPQRJlVa5HMLVAsg+KFUh9YqNY2vdrXAick52VzyfjfSVoIJOxJv4KE/+UHRU2pnBVrrg3CjTfW9oOYoFFuelXDg== X-Google-Smtp-Source: AGHT+IFtnYkUM38C+jeE9eD2PicQwt3qJEMNWOTyfkJjAcm6OsUjIT6silfDxmvOO6Y3X7gxrf7Z X-Received: by 2002:a05:6902:136e:b0:dcd:3663:b5e5 with SMTP id bt14-20020a056902136e00b00dcd3663b5e5mr12390398ybb.25.1715080558085; Tue, 07 May 2024 04:15:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715080558; cv=pass; d=google.com; s=arc-20160816; b=vIFIQucp9Mty4CY1yF2yxiSQWJLvpbF2CDf/Eg9ZPG2gD50VgO6Ahz6+oGLjph73/H cZYrik6/B7BjGX7XK+lYxX8sto0xlN3ttl7GWhLGcG1YaRgVdaW5fVRiKfkt60hY5/jd NlZ5TDSkgBGQ4j+5OmpZGTcCSnzcHn1vHQ7RsrMu2IDJsNy6fjf0PnvMwYqpubl7w+UL CAsKtrAtuDGzDHn4sM2BpxPFD2sI9kf1N/4tlPMBHkUmFZKdo1mMeSL2befeMPy3POBe ANY6gSQ1hlc5AS3Wzie369QUZUp4NZQwhgKk63NVvWILL7cXwEVrIxV5UeWzSTtndgJt Z12g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=gHDCteathS7tgD38CYMnmQG0o9h+erkrnQV5h+TtSbE=; fh=wmY4RLakUtHe8I5/hgPnrF2w+rym1ywlLWvkZ/HI6KU=; b=fe8LgSiIqdyAsntIdkLdTESK49UH+eJaXCE4gQC/L2QjdfElJaxY4VbToXpPId4kt8 oIKnbSsPhD1AYQt43Kr8cax0Zs8Kig+t0cbXBTCFQfOIrOgOe5xry9w2SnHf8QTEd76l JSGTOPc3JxJvplnxlZI/uOKYlNYzyZFZyzGclIm6XvJG71NhQeLyHFZJnaWVCp/txJM1 XbtPZncyZFPbKsT6F8u8iPFHf5v5G8J9ujjd56yb6nEk3P+2mJm+3SDLRUgW+pBR7Qf5 XaIaH2FuQou2nCq28NY5+BH7Iq5R26QPAlV0PotxTWYWe+tYiYACoCEA0iczfmqU0+fU BnwQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-171183-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171183-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id s12-20020a05622a1a8c00b0043add259b23si11396896qtc.238.2024.05.07.04.15.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 04:15:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171183-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-171183-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171183-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id CC0D01C23B09 for ; Tue, 7 May 2024 11:15:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 27388152DE3; Tue, 7 May 2024 11:15:37 +0000 (UTC) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1CFFB152170; Tue, 7 May 2024 11:15:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715080536; cv=none; b=uZixdnkdqxlW/MP6ZCVH0cl/Hu8gT9N/2EuMebWxC7rKa87J3v+KHWflvuujGzO4nNGAIgpHzbp+iFlGBGfgzH6Ttga+o+z0Jg0M4xzvCv3qFlBqxnfXXupKJZ/oHrYtTTqqq9ZKJV0NN9ivTwt5Ky4GI1eimHvcbSaQVmCWsFw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715080536; c=relaxed/simple; bh=qTksG14/AXe3UADF3lCbJ7w9tRhXaIrGr0xnZCBfOIY=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=uTu2shJZAZLJEvvtmEPl8kHdlWN1q0YsMbCaVOYoHPRgo/CNRn744oz+EfXi7PzJeuGaGUhCzKLHq45dqhB2npOGgzSqczzKHTRYMY8DvoE7+Zg6vhG4I8pQGeuqTYTchxPqbegN/SmHLDZQCeKwjfJG4yviBZciC25YPEpbDEI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpeml500023.china.huawei.com (7.185.36.114) 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 --- 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