From patchwork Wed May 4 18:28:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12838364 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 8E433C433EF for ; Wed, 4 May 2022 18:29:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AF3376B008C; Wed, 4 May 2022 14:29:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4F4D06B0078; Wed, 4 May 2022 14:29:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D0A376B008A; Wed, 4 May 2022 14:29:05 -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 95DF46B008C for ; Wed, 4 May 2022 14:29:05 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 6DF3A1654 for ; Wed, 4 May 2022 18:29:05 +0000 (UTC) X-FDA: 79428897450.30.2ED7CC4 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf19.hostedemail.com (Postfix) with ESMTP id C95BC1A008C for ; Wed, 4 May 2022 18:28:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=n9NMj4BZarLYBsrQRxi23hUYBJtKn1+fa2ahXmhQQvA=; b=hZY0WpxV35ESBVMZLTMMzE1lMU QapQ8OJF2i9dqQ1lTA//2ocDKqJbkw1zILK1+Es/R5HNmy7ETOUKIF9seQnUGxom+OVA00zWJoKpe k6SV2JMl2OdtoRUaeecjg8SCHWBSH2Phbo+NQ1n0rS7MnmJTxDOB/Z+U3TrB3lRDWB7Oy1VV7W6J7 q6kiK+GK74dq7nvgq2kB7zkarfbtcTHFEoqD+UZruCavr8zpzP9OUWgp+GcfNQSyL/84XItCGvVRV mrZL3CPg080a959ZT6rgyD/dTVTjkA0+T3nd5iV+bQUS3XkYoPjR33EDFx6mtgCJ/YqHAs7OBC7sR ThrRR+lg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmJkF-00Gq7q-T9; Wed, 04 May 2022 18:29:03 +0000 From: "Matthew Wilcox (Oracle)" To: akpm@linuxfoundation.org, linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH v2 17/26] mm/swap: Add folio_throttle_swaprate Date: Wed, 4 May 2022 19:28:48 +0100 Message-Id: <20220504182857.4013401-18-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220504182857.4013401-1-willy@infradead.org> References: <20220504182857.4013401-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: C95BC1A008C X-Stat-Signature: 7xygkci3yirer1nh9zuh3gh46yx1oft7 Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=hZY0WpxV; dmarc=none; spf=none (imf19.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspam-User: X-HE-Tag: 1651688938-643750 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: The only use of the page argument to cgroup_throttle_swaprate() is to get the node ID, and this will be the same for all pages in the folio, so just pass in the first page of the folio. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- include/linux/swap.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/swap.h b/include/linux/swap.h index f87bb495e482..96f7129f6ee2 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -736,6 +736,10 @@ 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); +} #ifdef CONFIG_MEMCG_SWAP void mem_cgroup_swapout(struct folio *folio, swp_entry_t entry);