Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4469968rdb; Fri, 15 Sep 2023 03:20:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHq3pXl2/I5cW0Nt2/oZ8FOVpQ/j/4rlgwpDNSdBktNTLsa7cfckUYxfz/ZJ7uLvNX7g9nd X-Received: by 2002:a17:903:11c5:b0:1b0:f8:9b2d with SMTP id q5-20020a17090311c500b001b000f89b2dmr1327726plh.29.1694773244067; Fri, 15 Sep 2023 03:20:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694773244; cv=none; d=google.com; s=arc-20160816; b=t7X2VyfIOul9nmY5tXcF3KRiw6rEuHru414YLnYibE+SEmSHfjMLiGKx6Vtulu0SYn ci/rVqF5npS5BueTmW17zhzwPvtFBD5Sm40y8qznvRjAVjGzEGpT/Ny57Ov5SYi/Tu1c RZBMxNOfbw5dKBlj10f+yAgyN8UgyGx9a2iGlcaL4qSusHhrLU/lSlDo9qnIBPRes33r OTi0J2Y6J7oLK/ebZju2CStyH/b/w8MpvnEuH7sGC1P3OSUhQ9WSMDaYbjbyi+fXcNwZ Qo8FIvkWxGsnSYb5SAjc90bzrZQ+UaBAJ9CWHzJbY1qQ6ksNeJIAEVzo7sZZbzWtpqMv qRUA== 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.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id p15-20020a170902e74f00b001bde8c9800esi3335602plf.459.2023.09.15.03.20.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 03:20:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id 594F383B5B5A; Fri, 15 Sep 2023 03:07:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233854AbjIOKH5 (ORCPT + 99 others); Fri, 15 Sep 2023 06:07:57 -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=20Koutn=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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit 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 fry.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 (fry.vger.email [0.0.0.0]); Fri, 15 Sep 2023 03:07:58 -0700 (PDT) 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 --- 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])); -- 2.25.1