From patchwork Thu Mar 2 11:58:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13157125 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 51D66C6FA8E for ; Thu, 2 Mar 2023 11:37:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E7D9F6B0074; Thu, 2 Mar 2023 06:37:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BB5A86B0078; Thu, 2 Mar 2023 06:37:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 926C46B0082; Thu, 2 Mar 2023 06:37:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 5A3696B007D for ; Thu, 2 Mar 2023 06:37:50 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 3DFF3AB795 for ; Thu, 2 Mar 2023 11:37:50 +0000 (UTC) X-FDA: 80523758700.06.1BFAE32 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf30.hostedemail.com (Postfix) with ESMTP id 0656480011 for ; Thu, 2 Mar 2023 11:37:47 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf30.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677757068; 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=MT8g8OM8Vel3TPORPNPfgy9B22EuLNyDvXMXmK9mTog=; b=770L5dPJD3gpAWfCgo0qRTyOislXvJwt42j+QmT+VH1bOmy/QXUhswQ70Ej2fUrBZV4jCD f5IVUVLG/9QHHd0QeZamjghMn1KpoppRoDyNoSCgmDtApLAiiTNypWGRd1ScYQKpTmVlKj OX0HtrAQ+xfJPoQsBEhwtT3If5QzF6c= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf30.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677757068; a=rsa-sha256; cv=none; b=O4Y1PSPACRGPDWIgWGWB5sgqWbchHBV18EtHKJNMJ+0oV+MFtoUV3FTWWwrpZeREF4wZZh HNmQ6jIdJE0/PNGHGQsdculpb5RXSYa4VfrUA+x5IMEUh1HA4PhQw+pLiqsIQ/NpMpi9/y nyFCSyfWAnd8JqhtzBW8isoz91QDBH8= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.54]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4PS8985SQRzKmRb; Thu, 2 Mar 2023 19:32:44 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 2 Mar 2023 19:37:44 +0800 From: Kefeng Wang To: CC: , , "Matthew Wilcox (Oracle)" , Kefeng Wang Subject: [PATCH v2 7/7] mm: swap: remove unneeded cgroup_throttle_swaprate() Date: Thu, 2 Mar 2023 19:58:35 +0800 Message-ID: <20230302115835.105364-8-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230302115835.105364-1-wangkefeng.wang@huawei.com> References: <20230302115835.105364-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 0656480011 X-Stat-Signature: j6t44guhrokspox89mswbh3ufx94ubhh X-Rspam-User: X-HE-Tag: 1677757067-111501 X-HE-Meta: U2FsdGVkX180X5E03S4UQvlxjF8c9uaO9bDeBzS2kcOSq21lJ8/GEebIbpx9Gmc07za9NjwYnujRQbvNdErZm49tnDCiJGjXyJFU+63ynhc+CaJkxrnGPMSwOglLqLj1KTHvXIc4uAseSqg4SIrcZUnobQ+UaooeI/2u63BYqKn7AAXpz1gVw9o57SxLaUfKrhceiKVtZygkLaYE1vDAwvV0NOSfWwHBF3FzNwOUpjz0GGAOm4KrnTKKKHuKysGsMSh6rw0Gb9RFB3Tg28PMWXmUz/nySQSv3O8p+8/g54YO4HIuefpp/NBpfF2K5m9Jkbmdo+oazua8evIgCl+FURWp5ZFW+spKCruAyC0nROVlK1t48dzUqNgGjkIGHMtFI1pqpljpdRb7hunKxVzjZkJvkTDQzDdNcoJWUv4p9I+ullJrRkFa43cpijNnhiKMVvYyGdWRO06WBFPE+b/PmZcZ0rgcjE4uiougcQuROw8nWbJGyvXHfcOKAIunGWqoT0zVRRQGLzSqSnZZjMymkAt06qOc2EAPXzWM5wasb66zLv9Lkwqg8BhJbt2nSpNjUFgzRHkSHaUkoc9pWQOJ9/+obwlMN5tvZ3QBiG4rxLJqogjpL9OptcMqBMnFbTvQgoNaZtlW4tD/R1dPIqOHMtLH2qUG4McQ52CA5b6XFRbqH4HCcDOb/8jOC8fmX4Oij1ZoOHv8wVtYrpBiCFRa3jPGRuk53VoG7pSZs1IA1DSaT8hR+lr0E4QFejVzycIyn0fykN+BwbsQ2iLs6ElK9UYrgWgk+i/Tf0CO8tZnt5657YCMqsjn1T2a/AntDO5JLABtbtYjSpxSoMRPw5OpZ+qGJKbkc5tnCQclzfYLEVnjeeaSh9QbMhSAvzExGiksUCAy6cOzsFffhZF2U4TjhNmnxykh1bN4id1OnmfTashXClVh94gIwA7iA/sVzL/3rNgNZSeplm8NZIOPQ9R isH/Pn60 HElDkRQQ99V4c1tAHeCXRd6nyTt1n+VStMJKzzyZduqYYi4QeM9nyhj7PLdHv4mKpqdV+q6YOyxmuvM/RNDuN5M74beXPvqeCKZC7tphAGHTh/5MPBt5r1Ef/UeSdSdEWy+DPyvzR2X8gcmwimJaJOL8lQ8H6G8e531xo+XHAOBwlZSSEDRcjBdVWBNMXTdaRpm7uXP9AmS/a/BYgeqYZ/IWUag== 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: All the callers of cgroup_throttle_swaprate() are converted to folio_throttle_swaprate(), so make __cgroup_throttle_swaprate() to take a folio, and rename it to __folio_throttle_swaprate(), also rename gfp_mask to gfp and drop redundant extern keyword. finally, drop unused cgroup_throttle_swaprate(). Signed-off-by: Kefeng Wang --- include/linux/swap.h | 12 ++++-------- mm/swapfile.c | 6 +++--- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index 209a425739a9..d5d0b54e90e8 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -641,22 +641,18 @@ extern atomic_t zswap_stored_pages; #endif #if defined(CONFIG_SWAP) && defined(CONFIG_MEMCG) && defined(CONFIG_BLK_CGROUP) -extern void __cgroup_throttle_swaprate(struct page *page, gfp_t gfp_mask); -static inline void cgroup_throttle_swaprate(struct page *page, gfp_t gfp_mask) +void __folio_throttle_swaprate(struct folio *folio, gfp_t gfp); +static inline void folio_throttle_swaprate(struct folio *folio, gfp_t gfp) { if (mem_cgroup_disabled()) return; - __cgroup_throttle_swaprate(page, gfp_mask); + __folio_throttle_swaprate(folio, gfp); } #else -static inline void cgroup_throttle_swaprate(struct page *page, gfp_t gfp_mask) -{ -} -#endif static inline void folio_throttle_swaprate(struct folio *folio, gfp_t gfp) { - cgroup_throttle_swaprate(&folio->page, gfp); } +#endif #if defined(CONFIG_MEMCG) && defined(CONFIG_SWAP) void mem_cgroup_swapout(struct folio *folio, swp_entry_t entry); diff --git a/mm/swapfile.c b/mm/swapfile.c index 62ba2bf577d7..c1b97436f811 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -3635,12 +3635,12 @@ static void free_swap_count_continuations(struct swap_info_struct *si) } #if defined(CONFIG_MEMCG) && defined(CONFIG_BLK_CGROUP) -void __cgroup_throttle_swaprate(struct page *page, gfp_t gfp_mask) +void __folio_throttle_swaprate(struct folio *folio, gfp_t gfp) { struct swap_info_struct *si, *next; - int nid = page_to_nid(page); + int nid = folio_nid(folio); - if (!(gfp_mask & __GFP_IO)) + if (!(gfp & __GFP_IO)) return; if (!blk_cgroup_congested())