From patchwork Thu Jan 12 08:30:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 42299 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp3761427wrt; Thu, 12 Jan 2023 00:24:04 -0800 (PST) X-Google-Smtp-Source: AMrXdXvuQFT+gLaVDoUXFo0euC/DLBAaddCF2bTnvHKlb5Ev7NPR3Qh9gke7HBu3AxeL8Iz56P83 X-Received: by 2002:a05:6402:2497:b0:48e:b020:6c14 with SMTP id q23-20020a056402249700b0048eb0206c14mr40387839eda.26.1673511844442; Thu, 12 Jan 2023 00:24:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673511844; cv=none; d=google.com; s=arc-20160816; b=nYz6gYlHgwLJVbVC00Lt7Ov1n9lT36Bazh+6AxhfIt41V1tb0QsG3085Yhv/BU1fHL 1RZvLbdajE/HLffuCuoCleFDtZX+rMGuSew4RdQk+iMK1+eBJR+zuFT9GiMLio1W5yAH ZaOzdB8x0awv7HJY5+vo+1CqxWzkGQTPr4Nay3i2f/vQEGIImqB0njOnlQgLZzDGr5Wf 1om9z3Pm4u8tvmMqeLtii3aQv7lfDhzrgo9+UBm3Pkkb6wx6aTgcdECKgguOcjfZSGmt J3cr/Rbk+eljWbGXZ7QF63uypK+8osjVpzy6m5ZZb7vn85fyoINRDmTySro+uZY6g2XR BT0Q== 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=+z4eofE9nff3vyL8ObJyK/MRgR2W0Z1B4DVPxEokq1E=; b=gY5GTVNZ5usYEXMKl/4HXbEQQoXZqBST+SperRqvZ8S6hUbnd41KhArKILPuuoJZQ3 nS9DZ0GUmgwzogtrl5wNG5Of4IgnrdeOGlt9I5yQDY4jTZx+rqIYvBuy/salgIf3LTyg 9twPnPaEUmvb/bDSof1QsUz51wnu2UorpcDCl2rMMReBljCvdVMGI4ZAmOk43SpeYtTc 89+GaWyl8vCyahEgHh1l3FV1DQ+4qqJyEtCa1j6ZPszdSiEhLqQLHyJqFZpeMN7T4cdn 22jMAVR6Ds9vW1twV9N5gRyIxmWd6FkvvYhRQ0yNGBfasWW2kqLqClXHxL+I7Uu38ba1 igqQ== 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 er18-20020a056402449200b004971b435d43si15668837edb.82.2023.01.12.00.23.41; Thu, 12 Jan 2023 00:24:04 -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 S239844AbjALITA (ORCPT + 99 others); Thu, 12 Jan 2023 03:19:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239622AbjALIRx (ORCPT ); Thu, 12 Jan 2023 03:17:53 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FBE23724A for ; Thu, 12 Jan 2023 00:17:37 -0800 (PST) Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Nsy6k50gwz16MZK; Thu, 12 Jan 2023 16:15:58 +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.2375.34; Thu, 12 Jan 2023 16:17:34 +0800 From: Kefeng Wang To: , , CC: , Kefeng Wang Subject: [PATCH -next 7/7] mm: swap: remove unneeded cgroup_throttle_swaprate() Date: Thu, 12 Jan 2023 16:30:06 +0800 Message-ID: <20230112083006.163393-8-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230112083006.163393-1-wangkefeng.wang@huawei.com> References: <20230112083006.163393-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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?1754804356192133231?= X-GMAIL-MSGID: =?utf-8?q?1754804356192133231?= All the callers of cgroup_throttle_swaprate() are converted to folio_throttle_swaprate(), so make __cgroup_throttle_swaprate() to take a folio, and drop unused cgroup_throttle_swaprate(). Signed-off-by: Kefeng Wang --- include/linux/swap.h | 12 ++++-------- mm/swapfile.c | 4 ++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index 209a425739a9..2674408e6d63 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) +extern void __cgroup_throttle_swaprate(struct folio *folio, gfp_t gfp_mask); +static inline void folio_throttle_swaprate(struct folio *folio, gfp_t gfp_mask) { if (mem_cgroup_disabled()) return; - __cgroup_throttle_swaprate(page, gfp_mask); + __cgroup_throttle_swaprate(folio, gfp_mask); } #else -static inline void cgroup_throttle_swaprate(struct page *page, gfp_t gfp_mask) +static inline void folio_throttle_swaprate(struct folio *folio, gfp_t gfp_mask) { } #endif -static inline void folio_throttle_swaprate(struct folio *folio, gfp_t gfp) -{ - cgroup_throttle_swaprate(&folio->page, gfp); -} #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 a5729273480e..3abf514c3f28 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -3636,10 +3636,10 @@ 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 __cgroup_throttle_swaprate(struct folio *folio, gfp_t gfp_mask) { struct swap_info_struct *si, *next; - int nid = page_to_nid(page); + int nid = folio_nid(folio); if (!(gfp_mask & __GFP_IO)) return;