Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1397441lqh; Mon, 6 May 2024 06:43:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWzEbn3mnMrcdmgyjJVMRUF/xJtpABwy9umYAfCB3TaDYiWYG/P7zHEEimhR/u3strklCtCG3SMG0ghQ/deO/D1BxWeo6Ct/H/OHEUlTw== X-Google-Smtp-Source: AGHT+IEDMJg0TFjxII7S7XG1r5VsSmLgktxFqlSWfan18WURn7gVx7/at9DHQD8ZGO19+dl2XQfI X-Received: by 2002:a50:bae9:0:b0:56e:2493:e3c2 with SMTP id x96-20020a50bae9000000b0056e2493e3c2mr6018146ede.37.1715003028210; Mon, 06 May 2024 06:43:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715003028; cv=pass; d=google.com; s=arc-20160816; b=AgZsPMBiF9DUup3xiWFOMokS5BwfO1Zi9caq3vWum3J29i+T/eSPmjoDk1K0X7rQOb Gicq6+Fi3xd2aruqT0x30+1pvSQ/UxKBWkePnwC7v5p6uf8+nfWLWRj4IZABdgnl+byr bPPlivW/Xhe2cP0yMENh7J5HqmQKJQM+oBH6mmQ6n2+th3IaDJOD2dcrJxMUT2X/90Rz p3XtbxjUbNZSibT0zancWXDz5kBvv4j0sU/+a0zg/G3nlzdDgERYr/8la0w1Csw6Omk7 HPFdSxTypBxBQfdX+f734OOsI4gquzA7/VQPQm27E0Tn6MCyDenLrQ1GPqncQdEUUk0l qdAg== 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=NCKjbobLiFscL3zoNgyIyvdtcSlPXNfbZ+cDoW6Z5nk=; fh=wmY4RLakUtHe8I5/hgPnrF2w+rym1ywlLWvkZ/HI6KU=; b=t3sXc9kqubbPTV2bwUB+iblg/ZZn7nJllNvao21lkghJdx96jQdlE0uhDpWgW0ZZLf tqqCGE7Aw2G7olwLEZetf42ZOhvo1pLliYdt+XX0RSEyCJlrdwFgkXyxgjVOcq+lk2rm QCZmdoa7IaPrrw04ZxfOqqP5XZz7Duvibi3vsYvvRn5ozaDLflvAeCMkl84NdnT4pcOL Od2YmgI6lcolPwN/s+doEtcUL+OXLR+GbMM/Oc9uKdsEDEZQ7FKFbkqwxmQlWvWz6e5s g8OwfFu13bKaGyDfuYdpHCarQQsE+0IyOsZWCCFXv4POJV/gTF/l7Hj6BeDyIpTZnna/ HwmA==; 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-169923-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169923-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id bc20-20020a056402205400b00572afeecebasi4843209edb.367.2024.05.06.06.43.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 06:43:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169923-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; 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-169923-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169923-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 am.mirrors.kernel.org (Postfix) with ESMTPS id ECE551F2220A for ; Mon, 6 May 2024 13:43:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C01E78C6F; Mon, 6 May 2024 13:43:41 +0000 (UTC) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (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 53B614642B; Mon, 6 May 2024 13:43:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715003020; cv=none; b=QhLTiQfbXxi8G0n4i050ysuE1pyfSnOVNv5QKIHaWra6Skpp646AGDVbYzL3YDE7Mf9Fa0VqHWVcNMnveZqZyr5dYsd8xxdZX6gIbMyt5ELTGzQ9LCeEWTspqq03WSxEd77oYTQYXTb0ftH8kVIECr7yoGWn+xZmW4n4QdqODNM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715003020; c=relaxed/simple; bh=nhwIlnyEtPbRTE8qpKMfmZn3Vfdf2AIZnGekxbXX+ck=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=S6x+pXYIpKRPDTlEcwZAoAVlquUTvOuakPujvz/4gBWHaCRDVuq6x3rTy3BaB//EKx5BKBv4cfq1Oks2H5JKkDZjShQrmSgZXi0Dl1YHPJ64YWpx5E5zq/CYRhX26bxsLXmDQMCBfuTQiWEJiIt1pF7vLcEhEJneYTyazS1iaPE= 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.187 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 szxga01-in.huawei.com (SkyGuard) with ESMTP id 4VY2bG6CQGztT3t; Mon, 6 May 2024 21:40:10 +0800 (CST) Received: from dggpeml500023.china.huawei.com (unknown [7.185.36.114]) by mail.maildlp.com (Postfix) with ESMTPS id E5C5E180065; Mon, 6 May 2024 21:43:34 +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; Mon, 6 May 2024 21:43:34 +0800 From: Xiu Jianfeng To: , , , , , CC: , , Subject: [PATCH -next] mm: memcg: use meaningful error code for return value Date: Mon, 6 May 2024 13:36:43 +0000 Message-ID: <20240506133643.1124102-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: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500023.china.huawei.com (7.185.36.114) alloc_mem_cgroup_per_node_info() returns 1 if failed, use -ENOMEM instead, which is more meaningful. Signed-off-by: Xiu Jianfeng --- 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