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: 13386789 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 8BECDEE644C for ; Fri, 15 Sep 2023 10:05:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 11CE16B033A; Fri, 15 Sep 2023 06:05:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0D5B86B033C; Fri, 15 Sep 2023 06:05:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EFE8D6B033D; Fri, 15 Sep 2023 06:05:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id E15606B033A for ; Fri, 15 Sep 2023 06:05:34 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id AC6FCA101B for ; Fri, 15 Sep 2023 10:05:34 +0000 (UTC) X-FDA: 81238399788.25.2D11DE7 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf22.hostedemail.com (Postfix) with ESMTP id 4BA4DC0019 for ; Fri, 15 Sep 2023 10:05:31 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf22.hostedemail.com: domain of liushixin2@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=liushixin2@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694772332; 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:in-reply-to:references:references; bh=Q6U02gIn0wqsgNK8gekwnFNbaIRS4upizejAMxY3sRY=; b=RArzpeReJfQW/Ir/VRDOSEV5tIBgpXLwE9cByUnV0sbuziukfZmEaSG4QpJXdS8IbBdeO6 Vxm15AuAayloDvvmW3WBWe3DT9uP+GEUP3ekEK6zcluqZPVV45xhJGUoHOoHOCQIGI2ElV W0D+CIwOwa6J6MzEeyW4XZvw6HS74Q4= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf22.hostedemail.com: domain of liushixin2@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=liushixin2@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694772332; a=rsa-sha256; cv=none; b=8AzBaq6cpPoEUg2Ne0Js6Qelfc+FwjIBTMgeuKrFNoCHh6pTINEMgezo0dULOnshe6dolI ylEyd4MsS+ku60KjBUUrHceHmUltI/8MxhnubgqT8sYl5flcwqwQ+RSoxbow9G8KGV5NAC Ui/qYg+1mFL4s0KMPF8sR0L5VxeqZic= 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-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 4BA4DC0019 X-Stat-Signature: 79hfqszgygw3fih4i1x9aji9e4csdkzq X-Rspam-User: X-HE-Tag: 1694772331-162510 X-HE-Meta: U2FsdGVkX1/uBE8g4qcgRYuadKeC5R9DKpBuq3M9zKrIQ5aGetnBpzhXrxULKgni0v13rjU3lGytUdzAbLKIEmwufJ2pHzEf5W0Ld8iKxXj/uVuQNQZNrSnsGIIMFgPydsFgL3SdCW8rQL17fuhecUv7//pbccGF2XBDk7FIeAQyRbeZaFcUJDO5MIE84utqi2ll5CWdN0nHZp6yb6yK7jKKefb60VugI+e9EskLf2CN5QMfzjEqdFu+zL+P3ITh5n/eTH8ePBkh5AJXm/1hk1jotWopeztesFPXfE8gNT/Ed32ISlKlQCALqsdcd0amXrOvksOPLumKddD9wwtURLwBWi9/0fYpMMjahhRSLFhe/ocZg20sbFI1KDX4AsJs0S6D1aF14UJ2LAtvhNOcHIRPPJo0liXrfeEfFb4irwidUC9xtlkAM4Rzx4AkFdRdVUT10ebrbTLM4MlT2PKyNfE/1QeDaHXjFxFDQK2O+SF2g15OKcO6qmZBkakN3uA6+k/0YEGsVD1/9rRygKNHBo6KVI2JfXuDvXrl574DgmzH45C6wARBAcnQLPHWY5d2mgXpp7VjGuAX2r+kyOHncDLhUY9B9wdvorazKaG7gX2jdQ6vm+celwlZ2dW3tm/99RZyvISLFNrd1tId1OLunyGzXI/wiwRgzE7RpYFDn9JZD3LFM5WlgGsB56IbjWb1uTyrjsHD8sWeWFM/EsJxvkl6v7FAThG8OidL06UXgR3atKq/vqhf+NHBtv70W/aXtt5RCqM54BpU+Es302wEa5kTixOEcVLkmhlS+6ykZc3aMpcwh+/X6rni/RYEbojSx/58BEmeiboI3RJr6x10rhhGul9R6NTljv5h70VLPvvD1PfFpBZq0/wCaZLb14CylJbBMcpE4fqztvWmQXt+hV2ynIvq16dFdVo5LYdI6e+8tKu/J12/w63i7UGw+DdenjVx4ydVv+QISOOSRdZ gEEoyLdd yY5fij73kO64qUhW41p9AYdYA2cNexkBrud11jkJ2HfI/2TZ9SYBjqjwmxxD6V0t4T0WGr+S9hCUCYtG8/lFAB1/2fh/vT1DqqvP4xqqdPB252tHwp+DUob7nac6b48GXy6Mm2k5fFcOclVIq5dNp5xJS2DyH6awjU8wQU2RCmAp7W28a4oDQqUeOM2f6/eyUbaj6NqIo9d9SCpXdfR0a1lTobI70BWB8Kz8kVggDnfmS7+NllVvbIp84brrHVCRohtJen4FrlXSotRc= 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: 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]));