Message ID | 20230706112820.2393447-1-linmiaohe@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2501884vqx; Thu, 6 Jul 2023 04:56:33 -0700 (PDT) X-Google-Smtp-Source: APBJJlGPfctxGkje9yOG3bGl02ENlKmtRYPNXduS7l4qJSG3GnD4pefKcX9sWHLtJ0HlhKJkDmRZ X-Received: by 2002:a17:902:dac5:b0:1b8:b3f7:4872 with SMTP id q5-20020a170902dac500b001b8b3f74872mr1905588plx.28.1688644593324; Thu, 06 Jul 2023 04:56:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688644593; cv=none; d=google.com; s=arc-20160816; b=TjWqliQESPo95SWJfmjEXSf9GugqrbIhXAEwZEGnf+58xN4lmdauxzQivnkpL1T0K4 x46g4jblxaNQ7ru3D6yvQ2A+a6O991vcFE9Z2ebG0Pu6wLgSFgvy+2H2acTNGpxxgq6Z 4fIr18/XWpASk6Ckwpi6V8oZOqRkerMT4wr2jnL2s7ONht15RBPqzV4i0j9KGZWhmKxy CNJ7L1tjkaEJAMfcqtfF4aXgwgaio2shnEqbdH8XHq8MZ5Wt2UnubfEHfm+pZjASEHLg wMLjNMfMVlrM2qXPFBcE+OzIe7m12ugUdox+Z38DJUt7CVdPOYbIEa5xsFVsw0pkIJ8F lyew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=b3unIiavzBPfNvJOgbxULNHpCIf2j7nG4zs2PkcRRKo=; fh=y+rTDXlY10tIkwo3JurBx9FKYH1rzS+78fIcgfVtGaE=; b=nwQEyU7pBMUEtrx8G6KCYXI7dUrRQBTKaIye7aZBjIa9C6lk5TxknOApbRbivtLjTg Apsm/6N2srJGfI82n1cF8sWSmcMAx3hv+VbVUPOWD2CYamYjtlZyfQMsW5QHF8FVZ6Wc eyqukMtxCyLGKP5851ZN/UHOCHB8wHwsjrUrjs4lwg2bwHBLPhVqn4PeEppQAq86r8Zk 1W6BpO3dW7CfCXdLAHoxUjR4K6c8PDefqvAStM2Tros9H96ROrk1LG0fssDufaEHZ+OI Vjq3zkPZ2HI2HI6nsXb05bAaPu4AXL9llTL0OWbx0OD3SNisAu/P0NEKlO9qnMUGOk3a C45g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020a170903018b00b001b7fa1a9a36si1231755plg.67.2023.07.06.04.56.20; Thu, 06 Jul 2023 04:56:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232202AbjGFL2I (ORCPT <rfc822;hadasmailinglist@gmail.com> + 99 others); Thu, 6 Jul 2023 07:28:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229515AbjGFL2H (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 6 Jul 2023 07:28:07 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7254BAA; Thu, 6 Jul 2023 04:28:05 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4QxZ1n323HzMqQD; Thu, 6 Jul 2023 19:24:45 +0800 (CST) Received: from huawei.com (10.174.151.185) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 6 Jul 2023 19:27:59 +0800 From: Miaohe Lin <linmiaohe@huawei.com> To: <akpm@linux-foundation.org>, <hannes@cmpxchg.org>, <mhocko@kernel.org>, <roman.gushchin@linux.dev>, <shakeelb@google.com> CC: <muchun.song@linux.dev>, <cgroups@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>, <linmiaohe@huawei.com> Subject: [PATCH] mm/memcg: remove definition of MEM_CGROUP_ID_MAX when !CONFIG_MEMCG Date: Thu, 6 Jul 2023 19:28:20 +0800 Message-ID: <20230706112820.2393447-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.174.151.185] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770672193171013881?= X-GMAIL-MSGID: =?utf-8?q?1770672193171013881?= |
Series |
mm/memcg: remove definition of MEM_CGROUP_ID_MAX when !CONFIG_MEMCG
|
|
Commit Message
Miaohe Lin
July 6, 2023, 11:28 a.m. UTC
MEM_CGROUP_ID_MAX is only used when CONFIG_MEMCG is configured. Remove
unneeded !CONFIG_MEMCG variant.
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
include/linux/memcontrol.h | 1 -
1 file changed, 1 deletion(-)
Comments
> On Jul 6, 2023, at 19:28, Miaohe Lin <linmiaohe@huawei.com> wrote: > > MEM_CGROUP_ID_MAX is only used when CONFIG_MEMCG is configured. Remove > unneeded !CONFIG_MEMCG variant. > > Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> MEM_CGROUP_ID_MAX is also only used in mem_cgroup_alloc(), maybe you also could move it from memcontrol.h to memcontrol.c. And define it as: #define MEM_CGROUP_ID_MAX ((1U << MEM_CGROUP_ID_SHIFT) - 1) I am not suggesting defining it as USHRT_MAX, because if someone changes MEM_CGROUP_ID_SHIFT in the future, then MEM_CGROUP_ID_MAX will not updated accordingly. For this patch, LGTM. Reviewed-by: Muchun Song <songmuchun@bytedance.com> Thanks.
On 2023/7/7 9:47, Muchun Song wrote: > > >> On Jul 6, 2023, at 19:28, Miaohe Lin <linmiaohe@huawei.com> wrote: >> >> MEM_CGROUP_ID_MAX is only used when CONFIG_MEMCG is configured. Remove >> unneeded !CONFIG_MEMCG variant. >> >> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> > > MEM_CGROUP_ID_MAX is also only used in mem_cgroup_alloc(), maybe you also > could move it from memcontrol.h to memcontrol.c. And define it as: > > #define MEM_CGROUP_ID_MAX ((1U << MEM_CGROUP_ID_SHIFT) - 1) > > I am not suggesting defining it as USHRT_MAX, because if someone changes > MEM_CGROUP_ID_SHIFT in the future, then MEM_CGROUP_ID_MAX will not updated > accordingly. Looks sensible to me. Do you suggest squashing above changes into the current patch or a separate patch is preferred? > > For this patch, LGTM. > > Reviewed-by: Muchun Song <songmuchun@bytedance.com> Thanks for review and suggestion.
> On Jul 7, 2023, at 10:06, Miaohe Lin <linmiaohe@huawei.com> wrote: > > On 2023/7/7 9:47, Muchun Song wrote: >> >> >>> On Jul 6, 2023, at 19:28, Miaohe Lin <linmiaohe@huawei.com> wrote: >>> >>> MEM_CGROUP_ID_MAX is only used when CONFIG_MEMCG is configured. Remove >>> unneeded !CONFIG_MEMCG variant. >>> >>> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> >> >> MEM_CGROUP_ID_MAX is also only used in mem_cgroup_alloc(), maybe you also >> could move it from memcontrol.h to memcontrol.c. And define it as: >> >> #define MEM_CGROUP_ID_MAX ((1U << MEM_CGROUP_ID_SHIFT) - 1) >> >> I am not suggesting defining it as USHRT_MAX, because if someone changes >> MEM_CGROUP_ID_SHIFT in the future, then MEM_CGROUP_ID_MAX will not updated >> accordingly. > > Looks sensible to me. Do you suggest squashing above changes into the current patch > or a separate patch is preferred? I think it's better to squash. > >> >> For this patch, LGTM. >> >> Reviewed-by: Muchun Song <songmuchun@bytedance.com> > > Thanks for review and suggestion. > > >
On 2023/7/7 10:25, Muchun Song wrote: > > >> On Jul 7, 2023, at 10:06, Miaohe Lin <linmiaohe@huawei.com> wrote: >> >> On 2023/7/7 9:47, Muchun Song wrote: >>> >>> >>>> On Jul 6, 2023, at 19:28, Miaohe Lin <linmiaohe@huawei.com> wrote: >>>> >>>> MEM_CGROUP_ID_MAX is only used when CONFIG_MEMCG is configured. Remove >>>> unneeded !CONFIG_MEMCG variant. >>>> >>>> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> >>> >>> MEM_CGROUP_ID_MAX is also only used in mem_cgroup_alloc(), maybe you also >>> could move it from memcontrol.h to memcontrol.c. And define it as: >>> >>> #define MEM_CGROUP_ID_MAX ((1U << MEM_CGROUP_ID_SHIFT) - 1) >>> >>> I am not suggesting defining it as USHRT_MAX, because if someone changes >>> MEM_CGROUP_ID_SHIFT in the future, then MEM_CGROUP_ID_MAX will not updated >>> accordingly. >> >> Looks sensible to me. Do you suggest squashing above changes into the current patch >> or a separate patch is preferred? > > I think it's better to squash. Will do if no objection. Thanks.
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 5818af8eca5a..634a282099bf 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -1158,7 +1158,6 @@ unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order, #else /* CONFIG_MEMCG */ #define MEM_CGROUP_ID_SHIFT 0 -#define MEM_CGROUP_ID_MAX 0 static inline struct mem_cgroup *folio_memcg(struct folio *folio) {