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: 63382 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4192589wrd; Thu, 2 Mar 2023 03:59:28 -0800 (PST) X-Google-Smtp-Source: AK7set9fJFFFmqCIItSRUaQj1BtPKyqI0/QdN/ZqlkvxxJ1ssuwYZf9d8rVEA1T1YwD+J30T2T5C X-Received: by 2002:a17:902:ea11:b0:19c:d5a5:1f52 with SMTP id s17-20020a170902ea1100b0019cd5a51f52mr12052343plg.18.1677758367940; Thu, 02 Mar 2023 03:59:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677758367; cv=none; d=google.com; s=arc-20160816; b=Q5qgY8P8kSwcOTgyED3JJcHhcgcT9McrCY7BgzNwRnSG2LE2YKnCF4yF/rEPnFRbrM qcIGhGzkMvU/w4t8Qa+A8kuSWjXcNveNgtmLWKXxwEaWGi7JWBf92Pe2XyrSlGWjZJUO 8e2USL95B5NMUhUBSj9V7E0amM/aU+YrX/0JZc+zGVHBl/HzidV+jjq/9oWmhziNt6ym 4P4iu924mpSc+dTa9d9p9N8P2N/EvgkE0pLm6VlAec0hkpIVcFvaVXtINP9E1eJTER8G oH1wnrTw6Wcryi+Dn/uLGygvGyhRezu6l8IBFaJe8eXsqnHrMacs/EKHvEZiZ+OCUssG Yh8g== 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=MT8g8OM8Vel3TPORPNPfgy9B22EuLNyDvXMXmK9mTog=; b=Q06lc/KollebjIh0uXUjSVOl75oDEJAX7ID4O2XA4RFkkytIA1RLV+1GjsPVKnQO6F I9hwreAtNUwTE2DnS8xZAoweyMjAlHC1a7d85yuM0lTzOtwXqymGbwmo94hwGCMvN6yE oIislNQmRv0yugYTxIHHzXrR2KA8hpi/mveEybhltawXlJByY97a1d9ZjG+xXYQHol/+ uglcDDaPL9igJteWWpsCGM4njYHeGZyAlocPDq1Zvq5RanzvFHGP3ej/QObIBd9j86cx 7bA1GMPV6qdOvVTlU9aCmDhAMNdDUwL46XxJ2Ivu+cAvNcMEcB3I7VIG58PHwkN5yni0 JX4w== 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 kc8-20020a17090333c800b0019ac3233e25si15211796plb.21.2023.03.02.03.59.13; Thu, 02 Mar 2023 03:59:27 -0800 (PST) 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 S229761AbjCBLxn (ORCPT + 99 others); Thu, 2 Mar 2023 06:53:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229513AbjCBLxl (ORCPT ); Thu, 2 Mar 2023 06:53:41 -0500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77E5E1515D for ; Thu, 2 Mar 2023 03:53:36 -0800 (PST) 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759257158656037638?= X-GMAIL-MSGID: =?utf-8?q?1759257158656037638?= 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())