From patchwork Fri Sep 15 10:58:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Liu Shixin X-Patchwork-Id: 140328 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp934557vqi; Fri, 15 Sep 2023 03:13:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF7Sdvla26sd6PlIWsIosfJbpVFvinQR6YHSQohD1EMnjMpVAwbx/QcaeHp4IBxQb5xcdsG X-Received: by 2002:a05:6a00:1a54:b0:68a:54e5:24e6 with SMTP id h20-20020a056a001a5400b0068a54e524e6mr1347452pfv.8.1694772804751; Fri, 15 Sep 2023 03:13:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694772804; cv=none; d=google.com; s=arc-20160816; b=R8XJyeaP8Db+FyDjH8EdgD8P5dGwei8tTaEgDo7ir60qyCgpaDNIbb1q+srMkPbYeb 0+gQ5LTsM2bIDQrf2Ad6bp7NbV2UI7EGE5cH4HQc8223QgLHo4lGjeDvxjKQomus4oXK 3r2nvZU1tZHS6Nlzh79gWXjhZzBZ0zUEMnBuUn4xWH2awhU3QdNEjaJGv+WaO/r61zp5 MJ7I+nUZKIe88zcjMoOb3VfpGzX7jGOJYwgWNh7cGn8NvJUML2ZFyiDIAcITdY3pymzd +Qp4XEb23NvEwb9Q0b14t53Nabe2TfLffTYJmdYA3UTH66stpusQavbjkzb3OXnf8uET ijRw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Q6U02gIn0wqsgNK8gekwnFNbaIRS4upizejAMxY3sRY=; fh=RQkjQsTB9MN2y2EM859QwzLXjpdZ6BmsHN1X9z9wMYM=; b=X3rvWL/A48Gn9F72iuvEOF70I+D5wHLSBQ1HogQ+uXKWJ6aJliq1PuXsoQZQIlXSuC pr0xvOGAl5sw98rvm7SczSXIC60qwkYAyQDZmIRelihQC8E67/pf+L86bfjjnAcfl47J c/I/1yst6rLiWm/jleB33Au6Ds4gq2adAtpgqlRprp/fyS9TEPif2OfdspNh3xg8JDHE 38JpVNsN3dWXaxg16u5VVzg4Rn098sTMt0KnmBRjz39BGsLVSW05h5JpQuRGujcnA6yW JjWW2r3o8sV2f5UQZU0sA5SkWqHpdYKG9sinO/wTRiu0rZ9Expb6tKsSTZc3aV6CpP/R ns5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id u13-20020a65670d000000b00564f934aabasi2988094pgf.112.2023.09.15.03.13.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 03:13:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 73E9B83B2D40; Fri, 15 Sep 2023 03:08:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233958AbjIOKH6 (ORCPT + 32 others); Fri, 15 Sep 2023 06:07:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234134AbjIOKH4 (ORCPT ); Fri, 15 Sep 2023 06:07:56 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 731263C19 for ; Fri, 15 Sep 2023 03:05:29 -0700 (PDT) Received: from dggpemm500009.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Rn8pg1m0hzNnfy; Fri, 15 Sep 2023 18:01:15 +0800 (CST) Received: from huawei.com (10.175.113.32) by dggpemm500009.china.huawei.com (7.185.36.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 15 Sep 2023 18:04:58 +0800 From: Liu Shixin To: Andrew Morton , Yosry Ahmed , =?utf-8?q?Michal_Koutn=C3=BD?= , Tejun Heo , Zefan Li , Johannes Weiner , Jonathan Corbet , Michal Hocko , Kefeng Wang CC: , , Liu Shixin Subject: [PATCH v2 2/2] memcg: remove unused do_memsw_account in memcg1_stat_format Date: Fri, 15 Sep 2023 18:58:45 +0800 Message-ID: <20230915105845.3199656-3-liushixin2@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230915105845.3199656-1-liushixin2@huawei.com> References: <20230915105845.3199656-1-liushixin2@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.32] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500009.china.huawei.com (7.185.36.225) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 15 Sep 2023 03:08:06 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777098088646566945 X-GMAIL-MSGID: 1777098088646566945 Since commit b25806dcd3d5("mm: memcontrol: deprecate swapaccounting=0 mode") do_memsw_account() is synonymous with !cgroup_subsys_on_dfl(memory_cgrp_subsys), It always equals true in memcg1_stat_format(). Remove the unused code. Suggested-by: Michal Koutný Signed-off-by: Liu Shixin Reviewed-by: Yosry Ahmed --- mm/memcontrol.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 78ea10c5a636..bb9a617be046 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -4112,8 +4112,6 @@ static void memcg1_stat_format(struct mem_cgroup *memcg, struct seq_buf *s) for (i = 0; i < ARRAY_SIZE(memcg1_stats); i++) { unsigned long nr; - if (memcg1_stats[i] == MEMCG_SWAP && !do_memsw_account()) - continue; nr = memcg_page_state_local(memcg, memcg1_stats[i]); seq_buf_printf(s, "%s %lu\n", memcg1_stat_names[i], nr * memcg_page_state_unit(memcg1_stats[i])); @@ -4136,15 +4134,12 @@ static void memcg1_stat_format(struct mem_cgroup *memcg, struct seq_buf *s) } seq_buf_printf(s, "hierarchical_memory_limit %llu\n", (u64)memory * PAGE_SIZE); - if (do_memsw_account()) - seq_buf_printf(s, "hierarchical_memsw_limit %llu\n", - (u64)memsw * PAGE_SIZE); + seq_buf_printf(s, "hierarchical_memsw_limit %llu\n", + (u64)memsw * PAGE_SIZE); for (i = 0; i < ARRAY_SIZE(memcg1_stats); i++) { unsigned long nr; - if (memcg1_stats[i] == MEMCG_SWAP && !do_memsw_account()) - continue; nr = memcg_page_state(memcg, memcg1_stats[i]); seq_buf_printf(s, "total_%s %llu\n", memcg1_stat_names[i], (u64)nr * memcg_page_state_unit(memcg1_stats[i]));