From patchwork Mon May 6 13:36:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiu Jianfeng X-Patchwork-Id: 13655502 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 84B92C10F16 for ; Mon, 6 May 2024 13:43:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EA8B76B0082; Mon, 6 May 2024 09:43:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E58E26B0083; Mon, 6 May 2024 09:43:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D20556B0085; Mon, 6 May 2024 09:43:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id B30A36B0082 for ; Mon, 6 May 2024 09:43:43 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 22535C0AB7 for ; Mon, 6 May 2024 13:43:43 +0000 (UTC) X-FDA: 82088088726.26.A41D5FC Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf29.hostedemail.com (Postfix) with ESMTP id 7ABF7120004 for ; Mon, 6 May 2024 13:43:39 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf29.hostedemail.com: domain of xiujianfeng@huawei.com designates 45.249.212.187 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=1715003021; 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=NCKjbobLiFscL3zoNgyIyvdtcSlPXNfbZ+cDoW6Z5nk=; b=8OqKmRs1fPAoC6H7Wffg55y/2Tba+2h/h60VJ9zgxkMuCfioKoaEzCx6F0lBpgCalOUMmc 9/8xcP3F93UhR0Ebp2keuu2qNpzlOu/Fs1YW0hr3PadI/xDcxmFF5YbVyWPwyH5yP700v1 ecuWTikHUiErC8P0pVz9Ogm0WHd6b04= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715003021; a=rsa-sha256; cv=none; b=CF+eAx75SDnXLvOEzmp4xFJlrgBN0Xk7NxZXuxk9d4udRIj45TLHjqKFovzu2tgU+d6Dzh vYtxs7BTmG6T9uinCYK9dXeDNkmWMOoFLBvTWsYixohkXIb650nsy6qe+gpvNcVheNDizr +laOyCdGgJQiZ9na6mBY8TekPlWL9vg= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf29.hostedemail.com: domain of xiujianfeng@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=xiujianfeng@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 MIME-Version: 1.0 X-Originating-IP: [10.67.174.26] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500023.china.huawei.com (7.185.36.114) X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 7ABF7120004 X-Stat-Signature: 16xx6aknj8boc4pgjggh57fnb9qaj6eh X-Rspam-User: X-HE-Tag: 1715003019-859882 X-HE-Meta: U2FsdGVkX1+6wCrd9YTSHQ5Ocu/j+2EZE8S/EcjohLK4WhM361TrMx+iFcgnrVdvGiDHtfzryKRLDtYaegmCZkuX13/G1ForDE7SnFImBrP33kEJuDaEtpjuMsdidUhIeaAsntlfCURizgUzQOQznks5rxMmfpQGcbcTxxRB8m3JcUp1maYWKiDNe1nBbdSAZFoGqKa4i/acDfs4ze40RVvtyEEm8D7f5zZLIWmU5e6YqDqRkH1FhaRV+ZYkMQqflJQlNX2wDnlrrK2/SsoTSDuUk7wpXuB9u/WEJH9w+eAaX7D117MpAwqg074op0FmQqsHskaMmoVczthcaULmJ/11wlJ7zOOuMViDNq55phHdXob8HrlihaxF8eCm/yswAbt93fcPDCDDR3voIj0cRJf4zZpV2nmXBremo7CSIA0moAiF3/I8Wl1zktB8/FBFhyHV4pFHAhrUuCElijWHRUg65TLURNyzVa8xR4+38r/VLXa0wy+ayYXrnmckP95gwdjgp8+TWbAN28tmBTWs/jGDd1JjlDWHbkKOHULAoU4Q4fp9y52dgKM2LZIcE7OJAsD564Jbu/P2Qrn7Yg4zKqGRavbouHUT+OSUMYHrwr6Vd9GCKf7W9ifer8X3fvdoA/m6SBHdncPXyl+HL4qrEinfQsYQ2am91asiUBdfqviYJ+55DHpRUT4a00Xvd78gQDJV/dR6gnw049DzcsCH8fESmMvwycbOCHW/GQXGuZD8Rmx3i4ZT9qr64E7i9IxMYnozBn6FE/Oh4zGoRt/MF1jdxxAJFao+vnrAeq23zj3BIcXkiBMUajfH7TSc12ivlJpoegKPeepGvpnP9+7YHmH91KQE5H1P018fDIj+RYwmF1jo8c7p4EXG8zLnHkotwmmy/7S/a/A4W7FVDCuikNTch6k194M6SnYz0zuqkeQ6mw0wA2T7EBrLL0JqHhW/r98Qf8Eaz4cOX1bpAiE 5Z+N/Itq P34cuS6Ah54TxSeaRboZTykgYhAFb51GXvLjE/ecfSYVMifSg7HIwvYL/YnHrWqYlVbJy7mX9upifrQ2YycZkca5rR/P2OYQb73IobeBYWUPpXOuuqKksKVIRft/vLAhOQhZ2yfYebPfSAZ9kzNfKBWusDw== 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: 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)