Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp523965lqh; Tue, 7 May 2024 06:38:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVAx3i9UjZI8C5giCXsOO3Mqr9gfXIOXc6cIjZiJezgUWzbCiy/F/e2oRHfyo0MRfoGfC2oxDn6M6XANUAIzvaB2Ye+D+X5RtFVr6wNWQ== X-Google-Smtp-Source: AGHT+IGNeCebReWjhRaGqCLUEjXoKPmxvyNklgp1b0xsYvvnW/AxQmBO0QDDbrIWEkKHc+JASYa7 X-Received: by 2002:ad4:4ee3:0:b0:6a0:cd45:2588 with SMTP id dv3-20020ad44ee3000000b006a0cd452588mr17738969qvb.58.1715089081463; Tue, 07 May 2024 06:38:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715089081; cv=pass; d=google.com; s=arc-20160816; b=WWIzfON/oVmG2biJZLALC5SrP6Ojm0tLJoh3XNSHTLhqdfux5qmLWKuP+4j3QJEhPW n8rSbWZFHwnjShwR0wKBPR9VqAaD4nVY5Sk7uf20gaR2EgCXUMMl5oIEfR4n3n3TN+ic 56nj+CdoaBfiXxLdgbbWUTY0OabthOt2DKAPuP/IphKmwP+Iw78uPTAUiAQqqlVGYnQu WPuvKKRB/0M630rpS0ozs2M0kyinPl78MOo43NArVcXLs7gJ/3Pgn/iToc0B9Hsp1Ktf tSfZuO2JlSsu/khCl+/MQ8NGW813xFeSMiB1E3tJ8jGUT0FKGNZHmsFCFZCRZG1pNZGb 7w0Q== 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=CFmP3XJ9ED2Np3imw2ozf490ANWpl4on7+nrjpMTWsc=; fh=wmY4RLakUtHe8I5/hgPnrF2w+rym1ywlLWvkZ/HI6KU=; b=pKfKYI5KBPKpAlsT7wdDVKHFJoMA2X1r6bjfdd7YBOlz0hxkfCt/iHIICUcPCFUrCF iuK5p2hZ85WA7wX2s/z4nvtPL/66A/cnIb0+5icahU2Kq8LOs5NUElLCHnltKtVU8aBt KRYyPEHWNC5MA50oDRnKDruR5Gxe8ovdD7CcJUAsLt15B1yjAQZjPhNJmJhjNKOgnkTH uPAH+za0AxToRxnCer8cpad3igxJSg2w/qeGacklY/xO5VsSo4Fz0j+FnAXsSACI/yU3 7gdjpVmaUD3D0eNJn04LOtA7K2aw0BlCwHfRqs3Ktaj0vKNduH+v89k0bSSQ5XzR5HNU Sv7g==; 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-171438-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171438-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id pn10-20020a056214130a00b006a0c964acb0si11893840qvb.308.2024.05.07.06.38.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 06:38:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-171438-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; 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-171438-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-171438-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 349771C23110 for ; Tue, 7 May 2024 13:38:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5ACC41635DD; Tue, 7 May 2024 13:30:25 +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 2075415F412; Tue, 7 May 2024 13:30:21 +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=1715088624; cv=none; b=q8d4H/WH83lUPI+OYegzZZw2m1DL4LL0M/9+7h0BnkqcBIA+yZO2Ha2reY4SYlBG4hpkW4v+2BylLpTG1nS9AiAot7jqpUA36kCgk73rtIEP4Ad7kB1frkX51gaETGQpHbry4nQX3X4pHKF2xFj5YacUSFY42YU08G7vnsf9B/0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715088624; c=relaxed/simple; bh=eIBo/rK4/UuN2nQCjJhvhD8Oggxyhot/vjrYauT0czM=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=RV01R4zQIrC0dRhA32t+4csu2z94FI65drahQtSWmqL+tNhmeZHdybhS+TL5TmdVt7KVyH+OQL/LcOVvTgULFJqhgfFeziY9fg1u5Fh6eNE4EZ0ZiaENNI/nrR8azgZKO4y3crt2rNbbFllRJ6uRhzTLMDs02OpxHDgNL+eW/sQ= 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 4VYfJ25KfdzCrNm; Tue, 7 May 2024 21:29:06 +0800 (CST) Received: from dggpeml500023.china.huawei.com (unknown [7.185.36.114]) by mail.maildlp.com (Postfix) with ESMTPS id 6E844180065; Tue, 7 May 2024 21:30:17 +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 21:30:17 +0800 From: Xiu Jianfeng To: , , , , , CC: , , Subject: [PATCH v3 -next] mm: memcg: make alloc_mem_cgroup_per_node_info() return bool Date: Tue, 7 May 2024 13:23:24 +0000 Message-ID: <20240507132324.1158510-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) alloc_mem_cgroup_per_node_info() returns int that doesn't map to any errno error code. The only existing caller doesn't really need an error code so change the the function to return bool (true on success) because this is slightly less confusing and more consistent with the other code. Signed-off-by: Xiu Jianfeng Acked-by: Michal Hocko --- mm/memcontrol.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index feb6651ee1e8..5d4da23264fa 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -5642,13 +5642,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_ACCOUNT, node); @@ -5664,11 +5664,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) @@ -5741,7 +5741,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