From patchwork Wed Dec 13 21:58:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13491921 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 A482BC4332F for ; Wed, 13 Dec 2023 21:58:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 105678D005D; Wed, 13 Dec 2023 16:58:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0B5158D0049; Wed, 13 Dec 2023 16:58:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E97DC8D005D; Wed, 13 Dec 2023 16:58:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id D55D58D0049 for ; Wed, 13 Dec 2023 16:58:52 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id A050D14034A for ; Wed, 13 Dec 2023 21:58:52 +0000 (UTC) X-FDA: 81563160504.08.5ABDDDB Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf03.hostedemail.com (Postfix) with ESMTP id D9AC12000E for ; Wed, 13 Dec 2023 21:58:49 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=hA1xqBKo; dmarc=none; spf=none (imf03.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702504730; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=VTPS5o/byYmwk9OFQloTDmuvZsrWNfGkucOclSw3UC8=; b=kmV1l8R9Z14c2im1cEAO7iubNaI1n7hpX9f/b7XlKoLOWkUDbSf8BIZJSe05bjhRa/EPeQ ZLb6DePwWELVcaHl0NOBW0WVGvhJLeceE8WMVMa4IbawN5A8Vn+HLi1nejmYKqe4KePxwg Pp4sArm8eDVnGoZRf22KqnsMck5Tml0= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=hA1xqBKo; dmarc=none; spf=none (imf03.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702504730; a=rsa-sha256; cv=none; b=T4AlIdPHnZ7RTwIFHjokiDLLFblGBie0p09fnMfW9ppeq1FN+BkBGfoNJua1tVZ/sWkicX 4EO9FfmknBomBGBjdRECk5fCzeH+1Vnw5Ck9GKBCagcudCXqG3aI/OLJybUJton98gr0ps Ut7BKEENn+UhFyHCwEXPioOcnYxsqq0= 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=VTPS5o/byYmwk9OFQloTDmuvZsrWNfGkucOclSw3UC8=; b=hA1xqBKoOwSweuidhOfjd7ZwYA 945uPxkf57pPk+RF3mrI5yK1gZ4cxzjByp1BONsfFTdWV6Mn2hDFINV25IzYUL6qhBBzdqh03U1FH wMZ6bMeRC09ehQWcFoinRbH8Ce1GCp/6KJkbkPyfwqf7W79XQWdwwhVtjycgU92k8ONd4C9M/QDsf k599Q/Ah/6rmHBOxp4LUmDy5emXtR0mQsgkjU6u+cFKlX5QPKjJYUN5wXypSRix7txT+zow01aFAk tM3T0076dyn6NTZ9E8VDtQrfjg3gSH/QcMoD0D4a0NVzbhoUHIo7hCIsEzUfF6r1pXtTOfv7y3I3g LH/h4s0w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rDXFd-002oiJ-7r; Wed, 13 Dec 2023 21:58:45 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 01/13] mm: Return the folio from __read_swap_cache_async() Date: Wed, 13 Dec 2023 21:58:30 +0000 Message-Id: <20231213215842.671461-2-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20231213215842.671461-1-willy@infradead.org> References: <20231213215842.671461-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: D9AC12000E X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: xqm87gxmzrsz3kxqpy76r3fexie1g3fn X-HE-Tag: 1702504729-670823 X-HE-Meta: U2FsdGVkX1/T45pdR3SEaHlDqBOcrJDaLw1RykWn6viZL+AVcZmBwAtBl9k4B+k2Rur6FdevhXJodxuH6CmgQq+3pTWfpVIiszgvPA2gCtozZQq42bZEYQKCYH83PhI3gAaNWyCCOL9XWDzMPPsGcOPJVrd2K/ukqtKR/QqHm8MKNbnmGhCy1FyiKp66FpNdWa5PK3BzmNVg+8X0/ViZuRPCPPRBM6gllLZX31YTIAMlC9LtMmV1DioJd9AeewV3eTy/JH07OnWB0X+BC0N15SMaDXlgViA6QLCFIuFDu+mS5NU2FNc/btGGzVC9uzakef+qdkhzDzibWtvOy5M9H6CzIacYqfvQ3/Ap/1u0kK4v3bYCdVyxmxZ6nZheGbIDg7t4olsKNEd6NY7IxMZv0kf9kasxy3t9WqlqypxpVy7K2dDJb8A9WUEmxEjrYsQG+4WVPI2Yz+VErb7iGwtzD4wheIrKUlon3rOcAFy74uvjX8RA1WoAoMycgeFqz+FBx5agj+3z8Tc+H+kHYtWRBxF6E5QjjkmAnshxMMV+voJTm41nymvbPQ/ReZqkvPLxQIZCDHvrJPlPlo1Q4XJ6wpqBeNd0Y8tX5Tske0tzvHQm1Zrwep1DVXy3GNrPj7NeZP7ytV75LaB+3a+nvk5/SWOT0yNg4KJK24Z6p08A5OadGT/8HJsK2xnF1LTwoLtSxvRVRFQ8vO8r8gokiVosyan4PtidmAbFOrk1JJUcasZhSIfCUi397Z/foQBtbV1PWG3GPm9OFhvPCh8ZTnzA8V/yCtDLPINAHbXG5bDVQndWEJm0mykOAH5JsoiXzkx1zS1IybWMNpEg7SeQKDrfO40ceEJhC8TzGdQtkmomGMU+hYSEq8OtO8NjM5TCNtS8MPRkMIJhlyORmSieEoo6TiZqPoEYtkp6nLvwm8WuknL+iaF9Hi0xt/1Q80NVdnNRk4aSDC2pe9WxEM33opk BMYXxWZZ iKnsE7IjQHeJA92LBpjVrfCagp/ZFs1E/3g5mu6k7VWlhdkF/jMzMcQ3FKn1jmytupUKFmKNNE0HsnO6g9QIWIK7f/A32v10+ziQQyK4cpzXVXwsJko7ECnfwBvnv2Youemqt2LFFZ+WWEWh67bKy+keYyl6jZvcBqSHvv16jY5Z0wNcbwgbXIt9M0XJmxHhLcPFliZT4qISipibIK6bsfsj2kOLBS7L91wYU 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: List-Subscribe: List-Unsubscribe: Move the folio->page conversion into the callers that actually want that. Most of the callers are happier with the folio anyway. If the page_allocated boolean is set, the folio allocated is of order-0, so it is safe to pass the page directly to swap_readpage(). Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/zswap.h | 4 +-- mm/swap.h | 7 ++-- mm/swap_state.c | 75 ++++++++++++++++++++----------------------- mm/zswap.c | 48 +++++++++++++-------------- 4 files changed, 64 insertions(+), 70 deletions(-) diff --git a/include/linux/zswap.h b/include/linux/zswap.h index 08c240e16a01..e88572d4c720 100644 --- a/include/linux/zswap.h +++ b/include/linux/zswap.h @@ -34,7 +34,7 @@ void zswap_swapon(int type); void zswap_swapoff(int type); void zswap_memcg_offline_cleanup(struct mem_cgroup *memcg); void zswap_lruvec_state_init(struct lruvec *lruvec); -void zswap_page_swapin(struct page *page); +void zswap_folio_swapin(struct folio *folio); #else struct zswap_lruvec_state {}; @@ -54,7 +54,7 @@ static inline void zswap_swapon(int type) {} static inline void zswap_swapoff(int type) {} static inline void zswap_memcg_offline_cleanup(struct mem_cgroup *memcg) {} static inline void zswap_lruvec_state_init(struct lruvec *lruvec) {} -static inline void zswap_page_swapin(struct page *page) {} +static inline void zswap_folio_swapin(struct folio *folio) {} #endif #endif /* _LINUX_ZSWAP_H */ diff --git a/mm/swap.h b/mm/swap.h index c0dc73e10e91..a60ab1cfcaf2 100644 --- a/mm/swap.h +++ b/mm/swap.h @@ -49,10 +49,9 @@ struct page *read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, struct vm_area_struct *vma, unsigned long addr, struct swap_iocb **plug); -struct page *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, - struct mempolicy *mpol, pgoff_t ilx, - bool *new_page_allocated, - bool skip_if_exists); +struct folio *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_flags, + struct mempolicy *mpol, pgoff_t ilx, bool *new_page_allocated, + bool skip_if_exists); struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t flag, struct mempolicy *mpol, pgoff_t ilx); struct page *swapin_readahead(swp_entry_t entry, gfp_t flag, diff --git a/mm/swap_state.c b/mm/swap_state.c index 7d775d0b1312..d4e25d9b5dc6 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -419,14 +419,12 @@ struct folio *filemap_get_incore_folio(struct address_space *mapping, return folio; } -struct page *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, - struct mempolicy *mpol, pgoff_t ilx, - bool *new_page_allocated, - bool skip_if_exists) +struct folio *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, + struct mempolicy *mpol, pgoff_t ilx, bool *new_page_allocated, + bool skip_if_exists) { struct swap_info_struct *si; struct folio *folio; - struct page *page; void *shadow = NULL; *new_page_allocated = false; @@ -443,10 +441,8 @@ struct page *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, */ folio = filemap_get_folio(swap_address_space(entry), swp_offset(entry)); - if (!IS_ERR(folio)) { - page = folio_file_page(folio, swp_offset(entry)); - goto got_page; - } + if (!IS_ERR(folio)) + goto got_folio; /* * Just skip read ahead for unused swap slot. @@ -460,7 +456,7 @@ struct page *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, goto fail_put_swap; /* - * Get a new page to read into from swap. Allocate it now, + * Get a new folio to read into from swap. Allocate it now, * before marking swap_map SWAP_HAS_CACHE, when -EEXIST will * cause any racers to loop around until we add it to cache. */ @@ -496,13 +492,13 @@ struct page *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, * stumble across a swap_map entry whose SWAP_HAS_CACHE * has not yet been cleared. Or race against another * __read_swap_cache_async(), which has set SWAP_HAS_CACHE - * in swap_map, but not yet added its page to swap cache. + * in swap_map, but not yet added its folio to swap cache. */ schedule_timeout_uninterruptible(1); } /* - * The swap entry is ours to swap in. Prepare the new page. + * The swap entry is ours to swap in. Prepare the new folio. */ __folio_set_locked(folio); @@ -523,10 +519,9 @@ struct page *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, /* Caller will initiate read into locked folio */ folio_add_lru(folio); *new_page_allocated = true; - page = &folio->page; -got_page: +got_folio: put_swap_device(si); - return page; + return folio; fail_unlock: put_swap_folio(folio, entry); @@ -554,16 +549,16 @@ struct page *read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, bool page_allocated; struct mempolicy *mpol; pgoff_t ilx; - struct page *page; + struct folio *folio; mpol = get_vma_policy(vma, addr, 0, &ilx); - page = __read_swap_cache_async(entry, gfp_mask, mpol, ilx, + folio = __read_swap_cache_async(entry, gfp_mask, mpol, ilx, &page_allocated, false); mpol_cond_put(mpol); if (page_allocated) - swap_readpage(page, false, plug); - return page; + swap_readpage(&folio->page, false, plug); + return folio_file_page(folio, swp_offset(entry)); } static unsigned int __swapin_nr_pages(unsigned long prev_offset, @@ -648,7 +643,7 @@ static unsigned long swapin_nr_pages(unsigned long offset) struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask, struct mempolicy *mpol, pgoff_t ilx) { - struct page *page; + struct folio *folio; unsigned long entry_offset = swp_offset(entry); unsigned long offset = entry_offset; unsigned long start_offset, end_offset; @@ -673,31 +668,31 @@ struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask, blk_start_plug(&plug); for (offset = start_offset; offset <= end_offset ; offset++) { /* Ok, do the async read-ahead now */ - page = __read_swap_cache_async( + folio = __read_swap_cache_async( swp_entry(swp_type(entry), offset), gfp_mask, mpol, ilx, &page_allocated, false); - if (!page) + if (!folio) continue; if (page_allocated) { - swap_readpage(page, false, &splug); + swap_readpage(&folio->page, false, &splug); if (offset != entry_offset) { - SetPageReadahead(page); + folio_set_readahead(folio); count_vm_event(SWAP_RA); } } - put_page(page); + folio_put(folio); } blk_finish_plug(&plug); swap_read_unplug(splug); lru_add_drain(); /* Push any new pages onto the LRU now */ skip: /* The page was likely read above, so no need for plugging here */ - page = __read_swap_cache_async(entry, gfp_mask, mpol, ilx, + folio = __read_swap_cache_async(entry, gfp_mask, mpol, ilx, &page_allocated, false); if (unlikely(page_allocated)) - swap_readpage(page, false, NULL); - zswap_page_swapin(page); - return page; + swap_readpage(&folio->page, false, NULL); + zswap_folio_swapin(folio); + return folio_file_page(folio, swp_offset(entry)); } int init_swap_address_space(unsigned int type, unsigned long nr_pages) @@ -815,7 +810,7 @@ static struct page *swap_vma_readahead(swp_entry_t targ_entry, gfp_t gfp_mask, { struct blk_plug plug; struct swap_iocb *splug = NULL; - struct page *page; + struct folio *folio; pte_t *pte = NULL, pentry; unsigned long addr; swp_entry_t entry; @@ -848,18 +843,18 @@ static struct page *swap_vma_readahead(swp_entry_t targ_entry, gfp_t gfp_mask, continue; pte_unmap(pte); pte = NULL; - page = __read_swap_cache_async(entry, gfp_mask, mpol, ilx, + folio = __read_swap_cache_async(entry, gfp_mask, mpol, ilx, &page_allocated, false); - if (!page) + if (!folio) continue; if (page_allocated) { - swap_readpage(page, false, &splug); + swap_readpage(&folio->page, false, &splug); if (i != ra_info.offset) { - SetPageReadahead(page); + folio_set_readahead(folio); count_vm_event(SWAP_RA); } } - put_page(page); + folio_put(folio); } if (pte) pte_unmap(pte); @@ -867,13 +862,13 @@ static struct page *swap_vma_readahead(swp_entry_t targ_entry, gfp_t gfp_mask, swap_read_unplug(splug); lru_add_drain(); skip: - /* The page was likely read above, so no need for plugging here */ - page = __read_swap_cache_async(targ_entry, gfp_mask, mpol, targ_ilx, + /* The folio was likely read above, so no need for plugging here */ + folio = __read_swap_cache_async(targ_entry, gfp_mask, mpol, targ_ilx, &page_allocated, false); if (unlikely(page_allocated)) - swap_readpage(page, false, NULL); - zswap_page_swapin(page); - return page; + swap_readpage(&folio->page, false, NULL); + zswap_folio_swapin(folio); + return folio_file_page(folio, swp_offset(entry)); } /** diff --git a/mm/zswap.c b/mm/zswap.c index d49aad0359d2..08b5212aa6b8 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -368,12 +368,12 @@ void zswap_lruvec_state_init(struct lruvec *lruvec) atomic_long_set(&lruvec->zswap_lruvec_state.nr_zswap_protected, 0); } -void zswap_page_swapin(struct page *page) +void zswap_folio_swapin(struct folio *folio) { struct lruvec *lruvec; - if (page) { - lruvec = folio_lruvec(page_folio(page)); + if (folio) { + lruvec = folio_lruvec(folio); atomic_long_inc(&lruvec->zswap_lruvec_state.nr_zswap_protected); } } @@ -1379,14 +1379,14 @@ static int zswap_enabled_param_set(const char *val, * writeback code **********************************/ /* - * Attempts to free an entry by adding a page to the swap cache, - * decompressing the entry data into the page, and issuing a - * bio write to write the page back to the swap device. + * Attempts to free an entry by adding a folio to the swap cache, + * decompressing the entry data into the folio, and issuing a + * bio write to write the folio back to the swap device. * - * This can be thought of as a "resumed writeback" of the page + * This can be thought of as a "resumed writeback" of the folio * to the swap device. We are basically resuming the same swap * writeback path that was intercepted with the zswap_store() - * in the first place. After the page has been decompressed into + * in the first place. After the folio has been decompressed into * the swap cache, the compressed version stored by zswap can be * freed. */ @@ -1394,7 +1394,7 @@ static int zswap_writeback_entry(struct zswap_entry *entry, struct zswap_tree *tree) { swp_entry_t swpentry = entry->swpentry; - struct page *page; + struct folio *folio; struct mempolicy *mpol; struct scatterlist input, output; struct crypto_acomp_ctx *acomp_ctx; @@ -1413,18 +1413,18 @@ static int zswap_writeback_entry(struct zswap_entry *entry, return -ENOMEM; } - /* try to allocate swap cache page */ + /* try to allocate swap cache folio */ mpol = get_task_policy(current); - page = __read_swap_cache_async(swpentry, GFP_KERNEL, mpol, + folio = __read_swap_cache_async(swpentry, GFP_KERNEL, mpol, NO_INTERLEAVE_INDEX, &page_was_allocated, true); - if (!page) { + if (!folio) { ret = -ENOMEM; goto fail; } - /* Found an existing page, we raced with load/swapin */ + /* Found an existing folio, we raced with load/swapin */ if (!page_was_allocated) { - put_page(page); + folio_put(folio); ret = -EEXIST; goto fail; } @@ -1434,12 +1434,12 @@ static int zswap_writeback_entry(struct zswap_entry *entry, * concurrent swapping to and from the slot. Verify that the * swap entry hasn't been invalidated and recycled behind our * backs (our zswap_entry reference doesn't prevent that), to - * avoid overwriting a new swap page with old compressed data. + * avoid overwriting a new swap folio with old compressed data. */ spin_lock(&tree->lock); if (zswap_rb_search(&tree->rbroot, swp_offset(entry->swpentry)) != entry) { spin_unlock(&tree->lock); - delete_from_swap_cache(page_folio(page)); + delete_from_swap_cache(folio); ret = -ENOMEM; goto fail; } @@ -1459,7 +1459,7 @@ static int zswap_writeback_entry(struct zswap_entry *entry, mutex_lock(acomp_ctx->mutex); sg_init_one(&input, src, entry->length); sg_init_table(&output, 1); - sg_set_page(&output, page, PAGE_SIZE, 0); + sg_set_page(&output, &folio->page, PAGE_SIZE, 0); acomp_request_set_params(acomp_ctx->req, &input, &output, entry->length, dlen); ret = crypto_wait_req(crypto_acomp_decompress(acomp_ctx->req), &acomp_ctx->wait); dlen = acomp_ctx->req->dlen; @@ -1473,20 +1473,20 @@ static int zswap_writeback_entry(struct zswap_entry *entry, BUG_ON(ret); BUG_ON(dlen != PAGE_SIZE); - /* page is up to date */ - SetPageUptodate(page); + /* folio is up to date */ + folio_mark_uptodate(folio); /* move it to the tail of the inactive list after end_writeback */ - SetPageReclaim(page); + folio_set_reclaim(folio); - if (!PageLRU(page)) { + if (!folio_test_lru(folio)) { /* drain lru cache to help folio_rotate_reclaimable() */ lru_add_drain(); } /* start writeback */ - __swap_writepage(page, &wbc); - put_page(page); + __swap_writepage(&folio->page, &wbc); + folio_put(folio); return ret; @@ -1495,7 +1495,7 @@ static int zswap_writeback_entry(struct zswap_entry *entry, kfree(tmp); /* - * If we get here because the page is already in swapcache, a + * If we get here because the folio is already in swapcache, a * load may be happening concurrently. It is safe and okay to * not free the entry. It is also okay to return !0. */ From patchwork Wed Dec 13 21:58:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13491934 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 99E44C4332F for ; Wed, 13 Dec 2023 21:59:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DD7E28D0068; Wed, 13 Dec 2023 16:59:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D60B98D0062; Wed, 13 Dec 2023 16:59:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B8B578D0068; Wed, 13 Dec 2023 16:59:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id A9BE88D0062 for ; Wed, 13 Dec 2023 16:59:17 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 8AA41120249 for ; Wed, 13 Dec 2023 21:59:17 +0000 (UTC) X-FDA: 81563161554.04.4737575 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf29.hostedemail.com (Postfix) with ESMTP id D7AB9120014 for ; Wed, 13 Dec 2023 21:59:15 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ZmfZlXBF; dmarc=none; spf=none (imf29.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702504756; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=rESDGRh+HGjvAVtWfRknecQJU7RLbVO98sVBBLWl39U=; b=6bRS9z0aNVSGW/7DNN2U76tg3Uln1PLHCVGgO78Wn6QvMpl1N+45StcwYXnH4I0lHMtRUH 0WoTdcyioYe/AiC4XkUTGdAwP6aRg+S4ogBAWaKrzUYcI8bURwJ+Kz9GBqQfJuw6PKvCoj MfZguAtGopAaIDOssp4F3jukMsTfxHE= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ZmfZlXBF; dmarc=none; spf=none (imf29.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702504756; a=rsa-sha256; cv=none; b=ICcqL/sKAi4j6V2oWQ6DNlRa6kX0SqjIyyiT1hZneHgNcx8bU08BYiyGrxbC9fLtIvTfX8 RDkuhklb5TfA5TkLh/FiYqxV4T6nzg/bZEGURwLOok9hYiVkJSmDSTR+d6+VzmRu5X1BZS xkJlMbMmsQ2DCjx5FLrHUbQcpzsK1cs= 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=rESDGRh+HGjvAVtWfRknecQJU7RLbVO98sVBBLWl39U=; b=ZmfZlXBFk68fx457s8jFnfIKT5 4SxXTBi9vHoLB9LYUDI9V3WDpirQhkII8p8hlbKpXGUlflH/F7cb4PuBzldiIYkRcozobUkWVlwdj CZMCFHQYupeIvoJLX3M1gnHJfMS/WgUFJ3tkKqc15+EaThQirB2uJq6UfkmqTq1swWbPLdpdxyvVd MSlEEe4tbmyDPOVYCK/Qp6WXuEdbY2PwSiQyZajXGoud9J4qmwSmpvqdybmRbQXeZjiCmFkZmx591 5ld4SfUAwRLTQU9CNYiGlRo4YVgQhzWldhs/S/9p49A1dwyNqtsas2Assb3UW1qgIePX0ySwdAOrr XFbXtJeQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rDXFd-002oiL-AU; Wed, 13 Dec 2023 21:58:45 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 02/13] mm: Pass a folio to __swap_writepage() Date: Wed, 13 Dec 2023 21:58:31 +0000 Message-Id: <20231213215842.671461-3-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20231213215842.671461-1-willy@infradead.org> References: <20231213215842.671461-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: D7AB9120014 X-Stat-Signature: 73t9swwsx513ifbj7p5staci1fxyejwm X-HE-Tag: 1702504755-301479 X-HE-Meta: U2FsdGVkX19svnD3sD73XkJ4zF8NMXZmRjgDQvNAyHlICnxSSOvpjd3E+o9TqQyXKU3qQqC4DJuQw/PdqS6Iss3Ds1f9cnzRNCAtFbwEzQUAf5K0l9fOJfcTWhu9RsU4glqqTycON7boxfxdJX5SmMCUqy8m41/az6M6dtmpe1P6lNU2furBvBLXYgig0VOORtUhWaqZVuYt6DfEFgVGGIlVqa2cEmEP9cnVfCFCBr6ES7VtuLn2K1v72wTgWWmoEq39vsNO5YqPzu6EVclpCCYlbaBB3q44Vov0jAqgIheVJfbD+k5CzyRB1xtbMPDqID4+c497v1xealzd1+MlqChLV41lijlN6aofTuzNwoUf/2dsMDsy3GWxBAR1/ZDyKmSaf1KYkIsPmI5j8BUHxBGofRv+MPoqR921PmxE6jbrBKtelRSWO3bfDhNtXV58mGU62ztDyCA/pzcmL98ajr3Qls/Il3vjDy1WaDkQl0y7iwSPk0XPcSEKdgkYebALFVPG0zQm12Jp/5NQZudMdS5/CnijvArlDtfMNfNqNmItEU+cirFkinPrOPazORCtYoFsGdugiGPkXZLCCCpbjoe+QZjVjSH4c7F6xuJyJMjM/hSS6XdCHPtlKC/W+8ejJNGp01pVk79qpqtGsYVN5OAHGjcK8eTmFuSavX69p8c4L0ZkYYXYkuC8hgg5Lr6Gu+QpVi+257JFRwLbNdtJOANsMotQCGeS2gXnBAI3/hDY+Krg15fgzAVuUDDETKVXRXE8MZ6vaR4zL50oPej81Xzs7lTxI71fs0oHfkd3D0uGQA+jirkX/4CRUH0kwOpBQoU8qhi7E/AcitZ8haxAJH9RXWDmcsB1rbQfJmEhy1yZBdUZrt0J4sSxCBvIIUWzyRTlMUqRsoEZdt7jCKvodOQnedfAdKo9eDVAjmYbt+bCLqW3c5J2z3Jsu/bd4em7B7s1DckEK5vlQ5gEsnx 8d9WPiY8 ZkaHo8eZTjWNw9HGOJ0bNVLKNQ2momgQEMOB54VcV3567u41ksMDtHYle5Ctx+AkHhBSQoUgIMK7NCiEpbgweg8eta6C8I8Pw2Lr+3sF+kJ3tZWc19EJHK8q09Z6Ox1voTsg1N2b3AgcO/W3NDjV36v6mMZqlmu7/sSp1ZWwjdAovQ8EBbBxP8xpbBc+jB/qxigBHW2FTq8bXPOM8qKBJoxg+9tOGRRICeogG 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: List-Subscribe: List-Unsubscribe: Both callers now have a folio, so pass that in instead of the page. Removes a few hidden calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- mm/page_io.c | 14 +++++++------- mm/swap.h | 2 +- mm/zswap.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index cb559ae324c6..e0d59f36b70b 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -201,7 +201,7 @@ int swap_writepage(struct page *page, struct writeback_control *wbc) folio_end_writeback(folio); return 0; } - __swap_writepage(&folio->page, wbc); + __swap_writepage(folio, wbc); return 0; } @@ -368,22 +368,22 @@ static void swap_writepage_bdev_async(struct page *page, submit_bio(bio); } -void __swap_writepage(struct page *page, struct writeback_control *wbc) +void __swap_writepage(struct folio *folio, struct writeback_control *wbc) { - struct swap_info_struct *sis = page_swap_info(page); + struct swap_info_struct *sis = swp_swap_info(folio->swap); - VM_BUG_ON_PAGE(!PageSwapCache(page), page); + VM_BUG_ON_FOLIO(!folio_test_swapcache(folio), folio); /* * ->flags can be updated non-atomicially (scan_swap_map_slots), * but that will never affect SWP_FS_OPS, so the data_race * is safe. */ if (data_race(sis->flags & SWP_FS_OPS)) - swap_writepage_fs(page, wbc); + swap_writepage_fs(&folio->page, wbc); else if (sis->flags & SWP_SYNCHRONOUS_IO) - swap_writepage_bdev_sync(page, wbc, sis); + swap_writepage_bdev_sync(&folio->page, wbc, sis); else - swap_writepage_bdev_async(page, wbc, sis); + swap_writepage_bdev_async(&folio->page, wbc, sis); } void swap_write_unplug(struct swap_iocb *sio) diff --git a/mm/swap.h b/mm/swap.h index a60ab1cfcaf2..b81587740cf1 100644 --- a/mm/swap.h +++ b/mm/swap.h @@ -19,7 +19,7 @@ static inline void swap_read_unplug(struct swap_iocb *plug) } void swap_write_unplug(struct swap_iocb *sio); int swap_writepage(struct page *page, struct writeback_control *wbc); -void __swap_writepage(struct page *page, struct writeback_control *wbc); +void __swap_writepage(struct folio *folio, struct writeback_control *wbc); /* linux/mm/swap_state.c */ /* One swap address space for each 64M swap space */ diff --git a/mm/zswap.c b/mm/zswap.c index 08b5212aa6b8..0aa3b434d9b5 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -1485,7 +1485,7 @@ static int zswap_writeback_entry(struct zswap_entry *entry, } /* start writeback */ - __swap_writepage(&folio->page, &wbc); + __swap_writepage(folio, &wbc); folio_put(folio); return ret; From patchwork Wed Dec 13 21:58:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13491932 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 3C1AEC4332F for ; Wed, 13 Dec 2023 21:59:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 109158D0066; Wed, 13 Dec 2023 16:59:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0B8E18D0062; Wed, 13 Dec 2023 16:59:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E745F8D0066; Wed, 13 Dec 2023 16:59:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id D28498D0062 for ; Wed, 13 Dec 2023 16:59:12 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B2B24A1C15 for ; Wed, 13 Dec 2023 21:59:12 +0000 (UTC) X-FDA: 81563161344.10.842B3C1 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf24.hostedemail.com (Postfix) with ESMTP id EB156180014 for ; Wed, 13 Dec 2023 21:59:09 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ut40WeIl; dmarc=none; spf=none (imf24.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702504750; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=LiLAAWMznx0lrGKk7Hps+YMdG+IWFpi8TmV7QhW0H2Y=; b=36dYRA4YDGRT+ieIs3XbgdVXWCzD2tDNvEJXr3u9eL3m+P/Vebpt638rdqJWrH9WTbuAq9 S1bZXB1jrc93NQtT9YmGToaRThuwPUHoys+stm51XloFGG1V8XLoi4C8GRmu7m1Pr8XYmb aM501jfHMejYXQTm4pQUrogyQ3nyX70= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ut40WeIl; dmarc=none; spf=none (imf24.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702504750; a=rsa-sha256; cv=none; b=Ht3t/Ui1R9ILutKDs5h6/WjPWbxMBjT6YnrzWos6a+wi9Q4SrZ1eCQa2davNScrlY/DpJM ups9RkCAJqMSM0sqz6C1s33CnmMGLoyUDoN36ZOtKoE63fsknK2OPwk9KGo3Lj0z9NgZ+m D7a9XQoIhFb1X5HizLxcAcptb4gvCb8= 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=LiLAAWMznx0lrGKk7Hps+YMdG+IWFpi8TmV7QhW0H2Y=; b=ut40WeIlSsZrekaM7GYfsx1NXh 142DOVw7yhzJVQWz9WZrYaqkGZpYwIa8QEAAglCEDN0JJyMVhrhyVv4scWjQ9n+tfzgoN5HpBpN+U YxNBRZOpS7BoXUxxOcyHr+MSyNFaeR31Yxa8dH2NzI4Jetg+keCIHsug7aKw7XqF1AqcJDu2aevZL Pthna/ROvnvXcrW4IJCXA5SrfAuLMltpoSlMA5fUqEoUBIgX9LgVBL4psQk63oh1mw2YQin3YD5vv f22m2HBUCUybJMvuXU54XbNEt/RX9WizQckhc4yw5wd9GlGaY4UcWm1Y+k03qWuwchd1ySGQG7Xq0 3CnYXZhQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rDXFd-002oiN-Cg; Wed, 13 Dec 2023 21:58:45 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 03/13] mm: Pass a folio to swap_writepage_fs() Date: Wed, 13 Dec 2023 21:58:32 +0000 Message-Id: <20231213215842.671461-4-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20231213215842.671461-1-willy@infradead.org> References: <20231213215842.671461-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 9zyiiccpse1s7xifugie16wht8cm7y9z X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: EB156180014 X-HE-Tag: 1702504749-81712 X-HE-Meta: U2FsdGVkX1+UWvZYji3T/Yvq7dqKxUetvyhiIgXPPVqik9m5ZMR2Ix14lFr1TW6m9L8QNXCYOmBeFEHT2h3QZ+QIS7YkRNjhPXcclyv86f3qEH5JVvRzhXHTW4zSt9qXBmvx+ZEEVf0ANd9G9Wx2QKd4wsHw3M3Z9NOO99qMlHlmBXbU6xFWq626/0DmnGT4UQpguDbSggnKjgTo2G9Sy1iNSlyxHzU+lC9iAIjXkzLI7+ZAbfYbE3ocDybi1Oj7HLLxbzom6CXVU4ZXUlwHx7JytwWpS1nciGia3RwbIF2HnFXOwoA0DB8QgA5g+g5PsiLcegdFqglclSfDUXqUxk1td4j1Jsx53d13OmYgolUmWU6StEipUR+zx5A/F4Qb9UvF9Z1fwGkiC/HV4pA7HPq2c4ez4XckCugN4n9ampHgOQW+nwBdN3APwHHEYWKNK8Dp5vIvy5C+7IW2fMENeuW2gkTSEAEw3TASXfX2gyiVwMGQ5vVNc7uic23Xn5WE6HG5i+KwUo4k155U9/GJgi/ufH/kUHVzbH2uIEXTTiRhztlJIDOzoU2QOQjizknIr7LddMTduEBwdVNE+ZiGqnUW8oaEt23M90V+miB94KmkMBljfyPCbg1zBiu0MbA/LdldgSmBHtBJFFXYWr5AsFRuL7NaXj/A/HmIcLHAJxM2Ae5GpLFnNdU6zqmtHXNRNp2e84ku8F2SDASMd1nJQDtq+kd0D4LFPlN+SOE818rHZdpPQqSFjmdYxOfVC4h1sRD47+7ZpIijCHDTFewN17XSqU5qyUy8LrX8kzq+U3H8vFqx+eG86MLI+9R2Ov2lFsn9rzAqmoO1B1GfaO0DRembPz8ayAiacCQ/96PkoP/rerK7cEXQBZXxR7EhBrW5lYgZUCKHT6i9SXn6HtBXfKovUyF1yeiShGR6vE8sQANgdnxWjY5mZ5uBkuju+H70mfXX8DsvPSaOqwz7iFA ZdvGDDul cGLt7vqD1FejpPugmv3u/eavNlKgRG41DA6OUWgbI/u+x01wkLQqvQkPh2LxGe+rDEFUgpUwJ8ISVhJlPcFfEyei3MSquGQcRV0ufmfRnXiUn3EUoC23eEuiNHU1i1rWBL3JvnLTNdhp+1oJ6xXroj5gYapVhddXAGKmDMk3EKEO9DABtC1k0hVWznRDXEABZnZKz1LEznbqQOE2fMxU4j2LVOP1hhA6Ps5uJ 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: List-Subscribe: List-Unsubscribe: Saves several calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- mm/page_io.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index e0d59f36b70b..7f67d8e2ed9a 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -288,16 +288,16 @@ static void sio_write_complete(struct kiocb *iocb, long ret) mempool_free(sio, sio_pool); } -static void swap_writepage_fs(struct page *page, struct writeback_control *wbc) +static void swap_writepage_fs(struct folio *folio, struct writeback_control *wbc) { struct swap_iocb *sio = NULL; - struct swap_info_struct *sis = page_swap_info(page); + struct swap_info_struct *sis = swp_swap_info(folio->swap); struct file *swap_file = sis->swap_file; - loff_t pos = page_file_offset(page); + loff_t pos = folio_file_pos(folio); - count_swpout_vm_event(page_folio(page)); - set_page_writeback(page); - unlock_page(page); + count_swpout_vm_event(folio); + folio_start_writeback(folio); + folio_unlock(folio); if (wbc->swap_plug) sio = *wbc->swap_plug; if (sio) { @@ -315,8 +315,8 @@ static void swap_writepage_fs(struct page *page, struct writeback_control *wbc) sio->pages = 0; sio->len = 0; } - bvec_set_page(&sio->bvec[sio->pages], page, thp_size(page), 0); - sio->len += thp_size(page); + bvec_set_folio(&sio->bvec[sio->pages], folio, folio_size(folio), 0); + sio->len += folio_size(folio); sio->pages += 1; if (sio->pages == ARRAY_SIZE(sio->bvec) || !wbc->swap_plug) { swap_write_unplug(sio); @@ -379,7 +379,7 @@ void __swap_writepage(struct folio *folio, struct writeback_control *wbc) * is safe. */ if (data_race(sis->flags & SWP_FS_OPS)) - swap_writepage_fs(&folio->page, wbc); + swap_writepage_fs(folio, wbc); else if (sis->flags & SWP_SYNCHRONOUS_IO) swap_writepage_bdev_sync(&folio->page, wbc, sis); else From patchwork Wed Dec 13 21:58:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13491928 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 E8BF8C4332F for ; Wed, 13 Dec 2023 21:59:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B422F6B02C5; Wed, 13 Dec 2023 16:58:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AC87B8D0064; Wed, 13 Dec 2023 16:58:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 969708D0062; Wed, 13 Dec 2023 16:58:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 83F9C6B02C5 for ; Wed, 13 Dec 2023 16:58:59 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 5747214035B for ; Wed, 13 Dec 2023 21:58:59 +0000 (UTC) X-FDA: 81563160798.15.BAFCFE8 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf28.hostedemail.com (Postfix) with ESMTP id BAA46C0002 for ; Wed, 13 Dec 2023 21:58:57 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ezDJ6yqY; spf=none (imf28.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702504737; a=rsa-sha256; cv=none; b=hVlylfXeV35uaSoJfifAYt6tTCfaPWJdK9nM4+B8mOSlVfz2IZTV9ydJZ8CN9ucbq7sSLF CJWt1qr1x+KpCtxkwP1+PD0sNwX+XmsraRIzyPCjVWNHPYGTuhd9X+r0F9zFiPiTIm1tXZ fPCUxLDE/rmX3DA0+5uuzYYDiMrA0FI= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ezDJ6yqY; spf=none (imf28.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702504737; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=RJGtC0xdK9xK8HUrQwoSAWCOkwlAWan2MRWph0zUvZg=; b=ppk7vfHv4tPTXVGE2PYm+vTTk2axujlVuc/3W/Gy/yUbt2nIzrPFCv7HyOnQb5rvv/3WJk eaqNHQ6SL2n353FeADr9Z9qJRqfWO3M8QLY4pnWWyKcdSsyF06al5v8IZ82ENEdrFS+Q/9 Wts++TmHRb8jglUBlftPFUD8aW6dk9E= 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=RJGtC0xdK9xK8HUrQwoSAWCOkwlAWan2MRWph0zUvZg=; b=ezDJ6yqYdSQMDQxjZUPB4Xj90s StYt03woRe6Evt4qZb2PNgn6GeOMHkFbm0TWEGBdHScljG2FfX9H9xceaOMnw/AWR++mSu+4M4J7T dnDrpOmKYFL/N5/DJWGMCBd0bEBEfUQMrFMl0MinW//6rWt9QuDK/5Gb4VbJietRtSdcF03s3q36f +PDREiRxqQ8UJNVIyWaQfZV+ycmAuvjPkaNjCewcijqfNQFED11jl0isUKeQt44HlUhCCmtS2G7ge cWTsae4vKHkjMwkYpUJvBqiszsd0FzPfsIOOWr7TH9xYG8vD3G+b9uiLJFiPt6i1zGqxuh64OQPTy nnZHTqqA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rDXFd-002oiP-FN; Wed, 13 Dec 2023 21:58:45 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 04/13] mm: Pass a folio to swap_writepage_bdev_sync() Date: Wed, 13 Dec 2023 21:58:33 +0000 Message-Id: <20231213215842.671461-5-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20231213215842.671461-1-willy@infradead.org> References: <20231213215842.671461-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: BAA46C0002 X-Stat-Signature: szasmx7zpd1byi4zb11wbgcs8kyqcrm3 X-Rspam-User: X-HE-Tag: 1702504737-271097 X-HE-Meta: U2FsdGVkX18ATaMJdV2Pj8LaGp2SUVUSdJ1aSl0V6uEqO4Pba7Y/G2gxRcjm3SRf5mYJIMGWCUxiLuwV/PqVkoXToujs7YjEbxtccBOsLcWd3OEflwJTl+7wdHXgwIO1tlz01aSYMPCqbDJHAFByI0ZR6vEfax6vcB22N18cpnrLcvH+x5CJp/WtY877PdUGQChxAgw5v7zQx20MwYX01AlQAMjmm3o8f2n/hYVPk4gtuEmduRl/h4elb/XoJjE+nsqqcyn4FqcnzBGeczqvlUZPjFZUdREbuiDxY5UUN/8wqRN8A/Leiqstk2NII8mgjuvj8NdNon7dfBCXRdf43gN21sw5JaUTBeTUbJ3GFWwpaFQvaKS7RaY7ljHCP5NUf1bM4y12oIKV/QBqWIZFehlq3+0/5mM6BvSFXIeCZY9COKM+E4lKWQ9TjiGjaM3Zj1ZmNJIcWxJtz9QvjFJC+fcxZnxFzZuhPPPW9GasPDNg4s7Uj175uUGgr5gh3YTnEyA6KpfnoPOMSbG6dcWM89bE1tlKe0E1QJbzDA88nNuAuNIINkzcOaWvKezbyKjbTkphTfltQbrVKrn3jp8NhO/nHilRhS9d7bgDBYD2EVB+H/73HbyAcEdCa/xg7Q1WBbtDKDKgjJJSycIwEaraY5wlHlW7MHe1dpfuSYJg7GvnOB8CFePD0iZQm9k+N9zERZFfpOVzMqgcsCt+9Wb4NZ/k4s5Ac2qouGv4oBlsLiUBD63AOPXqdaN1RiqUvKm7dMfBCnvqzZhr4bvbo3P6tr8jqWvfjmfrQBR89AuXIcGnAMv5mLpQpkOY0WghoaomGwuhKLkAP84Ko2rb8lWLa4bn/Ew+qRv2Xtieq3Yfm0IwK9WidvqOhGg1Wbtms7xQ3UVG9DD98sb04FgadodC9e09GdFTn4Iqugw5a6m4Ws669p06IHoYzs7oe6oE7oVUTKsyUt9BjsAK6Y9FFUa tjU5XMVC fzJmLOvUOjWp89Lbc5Qe9gG+R+febhNG7OjqMQsSYHtWtS2UoYDLcxZWlo907llLUkePLVXYGuUwyv7kvvtgFxdAUCEDX0XJRQv4ZB9mZ10+Ja3tqLnl8FS5tpfrmlOD13RSupHPCdy10Sa/8bTDGfKrJe/vj0SU4/sKGnGMwwybzya51ZRCdgRsGJidU4g/bZtkz5vswPW9BXOp2pJJ/q3eHfunOdELRl3cc 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: List-Subscribe: List-Unsubscribe: Saves a call to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- mm/page_io.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 7f67d8e2ed9a..1f57e26fa282 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -326,17 +326,16 @@ static void swap_writepage_fs(struct folio *folio, struct writeback_control *wbc *wbc->swap_plug = sio; } -static void swap_writepage_bdev_sync(struct page *page, +static void swap_writepage_bdev_sync(struct folio *folio, struct writeback_control *wbc, struct swap_info_struct *sis) { struct bio_vec bv; struct bio bio; - struct folio *folio = page_folio(page); bio_init(&bio, sis->bdev, &bv, 1, REQ_OP_WRITE | REQ_SWAP | wbc_to_write_flags(wbc)); - bio.bi_iter.bi_sector = swap_page_sector(page); - __bio_add_page(&bio, page, thp_size(page), 0); + bio.bi_iter.bi_sector = swap_page_sector(&folio->page); + bio_add_folio_nofail(&bio, folio, folio_size(folio), 0); bio_associate_blkg_from_page(&bio, folio); count_swpout_vm_event(folio); @@ -381,7 +380,7 @@ void __swap_writepage(struct folio *folio, struct writeback_control *wbc) if (data_race(sis->flags & SWP_FS_OPS)) swap_writepage_fs(folio, wbc); else if (sis->flags & SWP_SYNCHRONOUS_IO) - swap_writepage_bdev_sync(&folio->page, wbc, sis); + swap_writepage_bdev_sync(folio, wbc, sis); else swap_writepage_bdev_async(&folio->page, wbc, sis); } From patchwork Wed Dec 13 21:58:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13491931 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 C55F7C4332F for ; Wed, 13 Dec 2023 21:59:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 356F98D0065; Wed, 13 Dec 2023 16:59:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 262D58D0062; Wed, 13 Dec 2023 16:59:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 090A88D0065; Wed, 13 Dec 2023 16:59:09 -0500 (EST) 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 E07318D0062 for ; Wed, 13 Dec 2023 16:59:08 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id A5E3F14034F for ; Wed, 13 Dec 2023 21:59:08 +0000 (UTC) X-FDA: 81563161176.12.7951194 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf25.hostedemail.com (Postfix) with ESMTP id 05EA6A000C for ; Wed, 13 Dec 2023 21:59:06 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=YZgjIRgw; dmarc=none; spf=none (imf25.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702504747; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=L5hxk7Y0jVDBtRhrPGAgNnOg5HubQe2zAD3Pwoq6l3s=; b=IbZd/gefxUZl8Xe3e6bCoivvJIkvgkgSUF6DbLP0EZgQgGh+TWNPK6jMQHhCTjdrf8Jv3c jDU0tFKFHYPZYOijd7/meEs3TNS91TUOCQ9RvJPKahoKaod1Y++vC2zV06xUfXe1N0PSnk BACumaSJoeFhB6gLkWTy4sOXKr0vLx0= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=YZgjIRgw; dmarc=none; spf=none (imf25.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702504747; a=rsa-sha256; cv=none; b=JaGMQ3KllEhnSl+WWWMhzvdCUbbpf9bLqR1aFwY/RV5joQBIO89UChxjjmTL9/luDsyEaw 3Pa6pqayfzmKfHs2qfs1katPsUNL/Y0wX2mlVNUjfRm0AnTM9V8fbVdAPK7dQwPJLekANC gZ+3NIq1HpNlhoxTTbof5vFx2ZKRcpg= 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=L5hxk7Y0jVDBtRhrPGAgNnOg5HubQe2zAD3Pwoq6l3s=; b=YZgjIRgwMobY2+ao3VaoTLk0KP KScIjZgvGV5Ksm3Y/UkQrTucmTH2iiumDliXBWfb2CysIZqfrYlz8/8eGWkwl2BvZar5Dsgr0z3qM 0d6ZaeyjHol5z3uhl6kg+jKEWzazc7Yz2hjkfxYjPZoOg71u6FInoi1QGHGp4GulQqHXb7V2jGTmJ 6Kgb8lF1x9oXGgoD9MBJuUjTYdDB9DsihOaJ7oWZ6hLS5XUkcUsFxlPOaAM/NN1VFVZp4fXDbNF9y 37299pO4RrWmQRQ7Pj/4eAoP67NVSqLocVYPimDuK4anpVTJM7Po6tOiD4nzkms3FFcA/OHrJ42fZ qu58orbQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rDXFd-002oiR-HX; Wed, 13 Dec 2023 21:58:45 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 05/13] mm: Pass a folio to swap_writepage_bdev_async() Date: Wed, 13 Dec 2023 21:58:34 +0000 Message-Id: <20231213215842.671461-6-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20231213215842.671461-1-willy@infradead.org> References: <20231213215842.671461-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 05EA6A000C X-Stat-Signature: kxd1bi5sufjhxthme4pakaef1mrpi15q X-Rspam-User: X-HE-Tag: 1702504746-495923 X-HE-Meta: U2FsdGVkX19UxAloVy20wc2QIw2j+/siXujcVXrST4MQTafvAfY+x+zyfqVwRvl3T3pd6DcgpQLWT0/Z01nJfh1FX47Z+O+90PEaL00rK8qPBbemqnf74nN1YNSfTlLAEMRouXhdLTdx7SHmpz729VxN0dwTgiSEbNGOGUPp/vrzqYKsQo7OsJ1HtSvvA2AFqmFTA5v+DEWHg+MVVdICOPcENf0WwoGq4IOssCLODPfvpDfi4OZeFRz5F0S3pfo/th3KjRPcMFZBW9y+Zw4enKi67Z3TmT6YkCSK0K5kSHZwj8r7DS0x8o3s2dYgwyhK/NKa5uQDVkEwIlC4rBcHIvlHprMKa2ZYQHIuAl91dexGuFv29Q613wn130DWAUcYbTE6r24eD1xg7l8b9QPHOMlc7Bl2h59gt3ssb1oBdOPfjkeNyYAGrrJqFYJLm7MoUWNWVMNZbfj+81x2dn+U+YOTbn2ZMBbRCXWboT49P2a8QRZjixmGXPV2aTPwm1pBOw41fVYcAuEjx9H8Xe/i8yJBsynfJQ9tlZnXIlFTO4l/NX6/Z2GW7ni+f9xrM8cMu0vY+av/bDIH45wJeDOd487kWTspuADlbWihSnoOBOtIvpsatSVhbHUGx4h/ORvNhl6YHMAKylckF3+bWmTqV1fB+2/BfTm/dALZ4CiXx5zzSMiq3vZulU0JN+13UCpF/HjiljzgJ273cxCEYiBRvzflTZrURtAa4rf/XeHP3wKLFit/CLGvjKGZnyOHLNpPJqMQWETNO8avOwBatp44TamuaT2Tx/hkQYp5rtnlaS6htQcuK2yltS74ck4tFWxwfVeHieyWFaXGeLapymiH+/89Q5yH6llB8VyLAPGk+M3JHao6aI1Gk3t6u2cejhvkjtV4VZ4rsdQ6jUaBvxEqrHZPyL2RclX+jmbFhFhts8EfH9Wn4YCDwcDS/nRR/qMSR+La9bwgWpyBXxHdCC4 krnCmYFr xqvU0U+1549su5SpVnLKVwkQz3siYkiYJr82VqIwvXo8CNOCt11mPxDJhh8e0qXfJOnrliK/TSIwslkz49aZLvWeefk3OJo9T3/wN09YAj+QOtcumPcPOfCO+WgrsMf8DuNny51GPJCWwoOIXrIEwc58+RlsLImKkX/uqvQ/pns82NsaRwEWHfRIjQCaKA2CAFznYsnsXQ0cGWTG7JsXa0HpqvOPN5KtCBQ0c 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: List-Subscribe: List-Unsubscribe: Saves a call to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- mm/page_io.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 1f57e26fa282..454ab67b33e3 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -347,18 +347,17 @@ static void swap_writepage_bdev_sync(struct folio *folio, __end_swap_bio_write(&bio); } -static void swap_writepage_bdev_async(struct page *page, +static void swap_writepage_bdev_async(struct folio *folio, struct writeback_control *wbc, struct swap_info_struct *sis) { struct bio *bio; - struct folio *folio = page_folio(page); bio = bio_alloc(sis->bdev, 1, REQ_OP_WRITE | REQ_SWAP | wbc_to_write_flags(wbc), GFP_NOIO); - bio->bi_iter.bi_sector = swap_page_sector(page); + bio->bi_iter.bi_sector = swap_page_sector(&folio->page); bio->bi_end_io = end_swap_bio_write; - __bio_add_page(bio, page, thp_size(page), 0); + bio_add_folio_nofail(bio, folio, folio_size(folio), 0); bio_associate_blkg_from_page(bio, folio); count_swpout_vm_event(folio); @@ -382,7 +381,7 @@ void __swap_writepage(struct folio *folio, struct writeback_control *wbc) else if (sis->flags & SWP_SYNCHRONOUS_IO) swap_writepage_bdev_sync(folio, wbc, sis); else - swap_writepage_bdev_async(&folio->page, wbc, sis); + swap_writepage_bdev_async(folio, wbc, sis); } void swap_write_unplug(struct swap_iocb *sio) From patchwork Wed Dec 13 21:58:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13491927 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 BE422C4332F for ; Wed, 13 Dec 2023 21:59:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B41228D0063; Wed, 13 Dec 2023 16:58:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AF75D8D0062; Wed, 13 Dec 2023 16:58:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8F3A18D0063; Wed, 13 Dec 2023 16:58:56 -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 7E2338D0062 for ; Wed, 13 Dec 2023 16:58:56 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 5D13A16012C for ; Wed, 13 Dec 2023 21:58:56 +0000 (UTC) X-FDA: 81563160672.09.5528727 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf26.hostedemail.com (Postfix) with ESMTP id BDC0B14001E for ; Wed, 13 Dec 2023 21:58:54 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=aj65zAfI; spf=none (imf26.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702504734; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=6QZrmbGiKC0S/CkXP2LoCsNiQdWX6N+6eWMLbsxIB9A=; b=02spLJAlQWjHEqG3jwifTOSf9NkOLjrt9o9vGMye8eLV9YYrqU9w064tsEr6mlfUS2vKeV bWBtU1hmIpUYAcxCl1pHE8HzB6ZGaqSxAEd+J4f2en6T3ZAmQ3tbSFGY2utaEDWohD0nQh HR/HsP1rnLmQX5zmPyPUS8sCHF832yM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702504734; a=rsa-sha256; cv=none; b=XodcaOjnKPVQShGWhDW0vsOFPsGotQqz2IJBI6E0Q5BckmYhWzVTQA3aCtlnpaL4eDBZCf 2qW6m+NinrsBh5qpddkHtTXYE/sbe0hdz4GiJDGd2DQP5W5prYceVDFlz0UQ2WFiQgcNSG ATddpWlZmMg9Uf3WnQCJHu0/R03hS6A= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=aj65zAfI; spf=none (imf26.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none 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=6QZrmbGiKC0S/CkXP2LoCsNiQdWX6N+6eWMLbsxIB9A=; b=aj65zAfImNsXteqVujgkjokdzN vFSzWUWhvNPSp8TZHbTmC9dImr6ZqDUqQUTO/0xybcswhP4fXG5Bb+7cYSixjoubitKyqluSxxYh4 4oOFn/IML6jUhpP+B4g03Ml6LDOp4W7y+4XYZxf6cllgUQuJam8a1YFAhWVvdYQ3Jpt8aj8edjupc +gQQOTrtduTTGEBTYg3aW9F9OD7hQtR8NcIeM79nCaKU0pE1TKS+2iO17vB1Sfuph0gUlZyO+xzuS os//vyzH+Ntp8s32swYaNalW3/RNhtdhOJYDBMnWfzsKCN8/Vv/N8TRDvEDKAsYbFaK7RbsIf3mW2 zlij4Whg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rDXFd-002oiT-KW; Wed, 13 Dec 2023 21:58:45 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 06/13] mm: Pass a folio to swap_readpage_fs() Date: Wed, 13 Dec 2023 21:58:35 +0000 Message-Id: <20231213215842.671461-7-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20231213215842.671461-1-willy@infradead.org> References: <20231213215842.671461-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: BDC0B14001E X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: rgkuyjpuchnysi3bdg93z7g4im5wjcu1 X-HE-Tag: 1702504734-919789 X-HE-Meta: U2FsdGVkX19mJmuRZ+uSHby+/c/g4ZGeySgzufKTetnpFLu6HNOWiLfmTaiOntbFRsIB3jvySMM19fasroKRXnfCcgK3BVUzJ+BTZxTauqB8jFhRowEXcTNIqC46pX3uDUrCSGq+KTGv66Pa/e9BE4O6FUNsLtacNXu5CRc1Q29ih8SblWFMGHWrtjYE1fhaZ8OZJme0SfdhW4urPUhZyLO71d6ZRsm7YFD5RebmBIihgAPvZyrR9/hOX34jAENphQJzAZziIGHF2iFFFidoKKl1MB5ta5yTgMsXN1Sevfl7L58G1PkhU4Wv3oAUS7tpneCgNAesFq5uM3KdKFc/lFdNSsp4GGKHwsUEitT3D/nKauonQBh5Qe9yxOVRsmo6g+6KsOfB8IJe29yaoJ6mHJdK+Jm7FMfbQOibIncmO4dOTf47F8CLPN2rSFPi/KtAhYx6ZYqFTxIQYzVn8S+LblpwBrtWIz2euguSTPWmLiK91tYChBtp9LwRF8WG4rpZZMuR8okLcFqn3uS3xIqSIx0XBDqRttlyfxrHH9CUgHtK+66LZou3cfVz4CweovhfyN9ZN7Xpa8JyBkJv8u8uuD3k/Bz68/XAho/rjJQ6QJiMB3hp/br2pwgR03fPaJ0ObE7usv9G6grmCRAdit89R7yUWzAKZszpUtz/KGSRzgNWZYYKNXjIcdKbS4h0Y5+1+gFG+yd+ivNWfkSgdKknRj8e35awHYXjWgyMv8XkCcIDNSSInPKIp8RSw/GHSafXNk1lexLJGD8S9mpbfoWtnyMMOXtcmIENhTXPaoi4YQ0xhqgN4nlaeKvch+RJdaax0GK1U8oL67mUh9oKntk6IRWjmW048C7SoItjHxO3PZJ4PQ9V37qRFy7qONJKWWdQ/vbDVZMCAaEGcK3yTmuely2ZnOZ3yeWeyaEfPY0liHzKxIV6IjBGQH8VOPGFqsTK3XPOTsmv//6hsmIQgKb ePxizYtH dTadQrNcDvEx7GJEzo8NPxZqTF8/7Xx7wk1mFiee+m1gfPfp1fBmDo88RdTsDjRczIvHfzn7L905AFBFHGwPiUaFnIHnhvSZBXZE/oXdaaejCz+NBsFNOnKN/GJgDRuppDL2SUnppqB+0ipymalMU3BXkElGINFWUsqU/7H27m3/u/YkzzMJdQKcq3kCr3TkYUeMtMgi43aCKQKBzEhXn55CocVnPTAPDCsgg 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: List-Subscribe: List-Unsubscribe: Saves a call to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- mm/page_io.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 454ab67b33e3..864a558b7b68 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -420,12 +420,11 @@ static void sio_read_complete(struct kiocb *iocb, long ret) mempool_free(sio, sio_pool); } -static void swap_readpage_fs(struct page *page, - struct swap_iocb **plug) +static void swap_readpage_fs(struct folio *folio, struct swap_iocb **plug) { - struct swap_info_struct *sis = page_swap_info(page); + struct swap_info_struct *sis = swp_swap_info(folio->swap); struct swap_iocb *sio = NULL; - loff_t pos = page_file_offset(page); + loff_t pos = folio_file_pos(folio); if (plug) sio = *plug; @@ -444,8 +443,8 @@ static void swap_readpage_fs(struct page *page, sio->pages = 0; sio->len = 0; } - bvec_set_page(&sio->bvec[sio->pages], page, thp_size(page), 0); - sio->len += thp_size(page); + bvec_set_folio(&sio->bvec[sio->pages], folio, folio_size(folio), 0); + sio->len += folio_size(folio); sio->pages += 1; if (sio->pages == ARRAY_SIZE(sio->bvec) || !plug) { swap_read_unplug(sio); @@ -515,7 +514,7 @@ void swap_readpage(struct page *page, bool synchronous, struct swap_iocb **plug) folio_mark_uptodate(folio); folio_unlock(folio); } else if (data_race(sis->flags & SWP_FS_OPS)) { - swap_readpage_fs(page, plug); + swap_readpage_fs(folio, plug); } else if (synchronous || (sis->flags & SWP_SYNCHRONOUS_IO)) { swap_readpage_bdev_sync(page, sis); } else { From patchwork Wed Dec 13 21:58:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13491930 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 6BDFEC4332F for ; Wed, 13 Dec 2023 21:59:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 464336B0352; Wed, 13 Dec 2023 16:59:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3C5BC6B034E; Wed, 13 Dec 2023 16:59:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1A41F6B034A; Wed, 13 Dec 2023 16:59:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id EBA4C6B032E for ; Wed, 13 Dec 2023 16:59:05 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id CB690160120 for ; Wed, 13 Dec 2023 21:59:05 +0000 (UTC) X-FDA: 81563161050.29.9F9A3DB Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf25.hostedemail.com (Postfix) with ESMTP id 08918A001B for ; Wed, 13 Dec 2023 21:59:03 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=B2U0TbgK; spf=none (imf25.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702504744; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=w2zuG7w6TAO5KVgC+HOo1DB4SJrmM8vYX5bS/lYoi2U=; b=ReR3msvnNRxZjWsJcEO4uhqRnWSulwbYnEHcH16Ru6RWZMdF7ODfXPc8DPTA8zef7IXf+n 3VDAy/i9vd3OLKeEVoe9ggw/57T6FHod3QKkWaZ+XdySi/iYlWhcH3htKLHrGolBqMFLw8 y4BEIn6TEglSJL+vZBHZLieEdYQ6goU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702504744; a=rsa-sha256; cv=none; b=g9cQYg/SJMwPKaj9KPVtlDzHlccPd4duDAXiYz4iPane4J0XytxsSEtjKY8QGYQC4phB+M YMJHUTm/bG6QdC9bwQuj2afG1Q5/BcFIRersannz6Bp5CsISboN+OSdwrR9N9wiUryFJwx 5EKDqxq0bInQhvd2yJwRKMAzrGagnaw= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=B2U0TbgK; spf=none (imf25.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none 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=w2zuG7w6TAO5KVgC+HOo1DB4SJrmM8vYX5bS/lYoi2U=; b=B2U0TbgKyh6OgLlf81H+LeOrLp pETxhmUxl3N8erB999YhMPmpcphjbWdTz8wLwIAgrrsrYP8lLwZHSu75MtmD0mBeZN31FMm9Wf0mt +1JQnjhEzZcF0iZyDVrPVMZ1SjaztatVxIzA/fiogoA6Pmq5h7LvXr+PZgsBzhfbY2ngrV0KDRoF6 cJSil1qxKFNDNarqlb3NZ7Ilf9bbzOfqtMYpuEQ1UA1PJFOIWamo5wrXOkxI58UWxv4FlFZWpAPd/ B+6Salqv5ehSpPKzdJe9Tdw59GZ31HgM/V5itKSUKzpHUA89jo2nK+kDE6Aj6nTt8fM12bUI5fSIT 7QRfCwDA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rDXFd-002oiV-Nn; Wed, 13 Dec 2023 21:58:45 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 07/13] mm: Pass a folio to swap_readpage_bdev_sync() Date: Wed, 13 Dec 2023 21:58:36 +0000 Message-Id: <20231213215842.671461-8-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20231213215842.671461-1-willy@infradead.org> References: <20231213215842.671461-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 08918A001B X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: idu1h38b8y4mpx4ip95dxf3j58146sa3 X-HE-Tag: 1702504743-372810 X-HE-Meta: U2FsdGVkX1+Px+NHvc1e69BwCxDiviveL2MkkTpsvyzbPrrkVLuB6pBNzoim3mESDr07753n1nlRaDM56/3NPrRZi4vMl7Ji5LrytuLmtwrFib8OBVtzDRQISNzUZqKmiZ3j847LYG3rQsOHQFFLcsBtcxQs5YvDoq3ZJZdHU3yq1m0SsiLhxxPWnkG2L29LlOUnR+38y0IHEvFzhEFaOqwA1/sA9IR6vlx5T9+WREw2bKsx3tyKT9t8FHC+o4FnB69cm8X+Hq/67KU1qyaM19t3zAtLyX1Cmz5mJZVPrVodurOz9eqsAxZ2bdvK2Ysk791oKDKWQae3O8g4L4Dru3G41ZH2MW5pbt/DrmycRN1Hq4bqdvewKA7Fg6CgVi3iaz9XVlpJaYUEwTZ4kqHzyrmD2TxjjfBMMRjm7ts4HTdXjKGw4971tGd582ra6bHnmMMYqN3dTw2ewIRxTjSPqFiPgL08UhhtfDk6aQ1ckLVcR3cfRrxg2OmPEXurxEbPXbLq6/NPCjBLM2ct7XI39DsPMHBZccREtb27J4YM5QFYmMQAJrpGNTTtThL7IbxxlDEh5HaAR609BrifgzqGWynPd8+i4Z9X8vO7VH9iFT8odKVdfivtnpaYBBNI8Kd0mjhJ4ozvNmOxTcDxDI8b9P55iQCzIHq3jxDemu4VYPla13r9eWkzG0ZfQ4H35I/zvdbWniZVxTamcTGgZi8PiXjjno7QSFxZFZPYkJzhIeTYW3b4zVyhQIWGY0y6VDLNnB7srq5neSkgDV/Sd1ZP0xnIUtoZ1NbZ1hi20GBiicWqPW0GyFLjQtIVfY/ylM+EA/qSIqAAH00/EwOGEgC66sw10NTVqPJn69gC2+/7TO4AesH7KmaTXPEuEWofUJ5qj5n48jjUE1pFzzkKTSfKpVuOhN/IYdLd4h0bXkfb4wyBzv1/vGIFNODhfiy4SsHiLDEZPpjIS0PqLMoj6Sk m7Ts3vdY lJ8l5kv1p31vJUCkPGIVIUqQ8+43CS+3T2gUozA+L3Wg8n/EFNaPL2mG0PWh1CtZ5316OP44mhMQC6APzzyOQLrHQN0lTQVkzTPeUkCQGdwZoVskiTCK6YeHJoTGcm3TAJuJlkLyYFJvf8p2X46vI7yXhlgU6oVW/KdWIXGzNa3b4i+0tQpVPpMI+dXyN2xJKZJW8maarsKX09beTsiTj584h4bGKWGnvx9iF 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: List-Subscribe: List-Unsubscribe: Make it plain that this takes the head page (which before this point was just an assumption, but is now enforced by the compiler). Signed-off-by: Matthew Wilcox (Oracle) --- mm/page_io.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 864a558b7b68..0bc52e16452d 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -454,15 +454,15 @@ static void swap_readpage_fs(struct folio *folio, struct swap_iocb **plug) *plug = sio; } -static void swap_readpage_bdev_sync(struct page *page, +static void swap_readpage_bdev_sync(struct folio *folio, struct swap_info_struct *sis) { struct bio_vec bv; struct bio bio; bio_init(&bio, sis->bdev, &bv, 1, REQ_OP_READ); - bio.bi_iter.bi_sector = swap_page_sector(page); - __bio_add_page(&bio, page, thp_size(page), 0); + bio.bi_iter.bi_sector = swap_page_sector(&folio->page); + bio_add_folio_nofail(&bio, folio, folio_size(folio), 0); /* * Keep this task valid during swap readpage because the oom killer may * attempt to access it in the page fault retry time check. @@ -516,7 +516,7 @@ void swap_readpage(struct page *page, bool synchronous, struct swap_iocb **plug) } else if (data_race(sis->flags & SWP_FS_OPS)) { swap_readpage_fs(folio, plug); } else if (synchronous || (sis->flags & SWP_SYNCHRONOUS_IO)) { - swap_readpage_bdev_sync(page, sis); + swap_readpage_bdev_sync(folio, sis); } else { swap_readpage_bdev_async(page, sis); } From patchwork Wed Dec 13 21:58:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13491922 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 3D5ABC4167D for ; Wed, 13 Dec 2023 21:58:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6AB3F8D005E; Wed, 13 Dec 2023 16:58:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 65B298D0049; Wed, 13 Dec 2023 16:58:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4D4158D005E; Wed, 13 Dec 2023 16:58:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 369728D0049 for ; Wed, 13 Dec 2023 16:58:54 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id F238280370 for ; Wed, 13 Dec 2023 21:58:53 +0000 (UTC) X-FDA: 81563160546.02.A7F904C Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf21.hostedemail.com (Postfix) with ESMTP id 573A81C0009 for ; Wed, 13 Dec 2023 21:58:52 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=wDsLOCja; dmarc=none; spf=none (imf21.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702504732; a=rsa-sha256; cv=none; b=jGrMaSgQ9pyB4mXxmfHqodEtKP68WqyInNW8Kod3GTwiIo4cHOIipZd3bKGepIKIe2PhY8 LB9vEoq9upFjSIHXmdDQCW5vLUt5TqE1hU+7Gku3DRrPCAY73LdzAL5IFI/HldrXPiwglQ GaJuy/F2Y2TW+7RR1Ucp6hg5zmJdot8= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=wDsLOCja; dmarc=none; spf=none (imf21.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702504732; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=lw+qwrt+KKR5QlG7QzLE80oGlMWbv0Oz38MMkGdHuTc=; b=C4TgMgpsHW7ocWmE0zhtmCPz03oQoq/bXh/ZSCL+YDSe+lUOxLzMJOdkqOt66aIekauf8O rEQ2YzplElYa62mTyO9CZvYU5fkG/Xa+CGpLVmNBqyT8qY6N4h61cdN/Tv87StFDJ1KHeX vF6lNT+Ku98w2+NE1kkViRY+IsLCbsA= 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=lw+qwrt+KKR5QlG7QzLE80oGlMWbv0Oz38MMkGdHuTc=; b=wDsLOCjaC9pST9/f/lUpKdZ/O/ IVbCCA6q19SBzhxOQfbQPOVuNGPj23oh1exhmufLAGa93yU9BIETTcJ0nsgBozn9BAZktgBAhZWMs ToapnhfJsoD3jNF/LedeuG/KSPtrLuHuWkxa4KV4LtA3JYB2dQkoqbHxaARoqoWWk2OElbIZ8SjLq 9uz9rXFSxMFSI3KyAOfORQjVgb2WXCl9ezTUfxz8wnYgvVgrhE1jcTO5H1c2O+AUny/CU97jslabM k/PB3OxI0Uyjz3CJv1e8BX0Jr1wHcy1P9YhqqL0V08KFot9CxKnCN43CL/dswdXGpEnRa8rl+Xd6c ImDAD81Q==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rDXFd-002oiX-QS; Wed, 13 Dec 2023 21:58:45 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 08/13] mm: Pass a folio to swap_readpage_bdev_async() Date: Wed, 13 Dec 2023 21:58:37 +0000 Message-Id: <20231213215842.671461-9-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20231213215842.671461-1-willy@infradead.org> References: <20231213215842.671461-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 573A81C0009 X-Stat-Signature: 9domob1g573ufge5dxy7md5pkhhrmeof X-HE-Tag: 1702504732-31489 X-HE-Meta: U2FsdGVkX1+VoxWCVFzILZt638TOj6RIrx3oDy2DoMw/SvjtpMsy2F7NsfPn7xE25AGGmmXNKAXJFP+uitw+KoKJ6UC8PhvY7Dql3pdlPMjQcUJQHdcz8W1Jt4rYSTc56lL+z2yr+9FyAMNakmjMuTJH9hAVPS0SSW7bAa5ErNinffLz2VkYvLeps/S3CY+lJRrT5AGs75xcEzg9NEnxdTyiGUEMko4D1Zv48zvOpg6A2GwovSzDc0X5mJSpB4J3KB/5Y+oIUbsvc/BDAFEJcrT2U7/jrNBP+d1oU27fFZTmBPjrGxlyrC4nKuymYrfNvzR9X6WAd3q/cUJXara5zjwNFRm/jWUzfeuc3MVhmYeNsF6/h5V0zEtXOrnFRDDBnIVTDl6Jr6OEvqLvWYk+52jVPbr+xaNtlD0O9x4g0LdSLlJYu9rhURG3s+E15Hc1uPYBXm2GXoxyTiLN/X8QhD90Dn4d9gMHIO8zhO2FkKoaOSehy5hWRwjeIMCFn1erHg0mBKVp8gyH4Ua2Uu8Y+eryIS8P/1jPnjmBlMSudOuvHV9UDtX2jpnH+Bekkxqg1p2zngYIuKyE5iCCwC7/WWfyxa1WT0JDIEcxHCdS5HUwwn6LBSsXlZ0TQF6r5W4ipyxhP9gsKapg0To1U7aW61SnNPhz+UnZTf16uLauuioZfWkbSve0UK3yfodyq9NNF/l53YtfDLddiqXTTAY+fdVVtkoIZJK+MN22DnPLvkx7Pe3dzrZh29P5k9PTGQP4rNiJrPzmjAKFKaDP9DdvK9sU/qUEYfLEx5vmZvrgYuhZWRRofr3jqNhUOAZ6gkwdkE095WNqp2yDH4VBii8+70ra12HbXeh3LohQX1njpddTTenz9hPeJwoD1A0k9npyG5z1LTzd9PVrTXu3+wRT4MV3LObd37vOzaYviv2AxWAcyV9lBx2JD5CD6Jthwn30I2lS0MW+qo4yfnnJR17 z7PqrCxM Vx49oymSR85PigzrsBzATRt2av2WNbqssC5/gNylzX5J127dAdnghcOk80pRlsHQSkIC9zl5Z9qLcXrxHTsdNaAW1B6G2RxG6lqaEVGxsCJMrFNZm8Qgoae4fAfPxK9Lk6cpf69Ud+SQAGJJOuT5L1+c9CTaulPpCzb2PnzbsY4tHQRPj2DEdonCpRwccYFv+lRkrGK6j3Wej2dtVQkY7KQNmwmHjWmYtG2lU 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: List-Subscribe: List-Unsubscribe: Make it plain that this takes the head page (which before this point was just an assumption, but is now enforced by the compiler). Signed-off-by: Matthew Wilcox (Oracle) --- mm/page_io.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 0bc52e16452d..e18afcd9c19a 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -474,15 +474,15 @@ static void swap_readpage_bdev_sync(struct folio *folio, put_task_struct(current); } -static void swap_readpage_bdev_async(struct page *page, +static void swap_readpage_bdev_async(struct folio *folio, struct swap_info_struct *sis) { struct bio *bio; bio = bio_alloc(sis->bdev, 1, REQ_OP_READ, GFP_KERNEL); - bio->bi_iter.bi_sector = swap_page_sector(page); + bio->bi_iter.bi_sector = swap_page_sector(&folio->page); bio->bi_end_io = end_swap_bio_read; - __bio_add_page(bio, page, thp_size(page), 0); + bio_add_folio_nofail(bio, folio, folio_size(folio), 0); count_vm_event(PSWPIN); submit_bio(bio); } @@ -518,7 +518,7 @@ void swap_readpage(struct page *page, bool synchronous, struct swap_iocb **plug) } else if (synchronous || (sis->flags & SWP_SYNCHRONOUS_IO)) { swap_readpage_bdev_sync(folio, sis); } else { - swap_readpage_bdev_async(page, sis); + swap_readpage_bdev_async(folio, sis); } if (workingset) { From patchwork Wed Dec 13 21:58:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13491929 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 1C9DAC4332F for ; Wed, 13 Dec 2023 21:59:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5E8898D0064; Wed, 13 Dec 2023 16:59:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 570798D0062; Wed, 13 Dec 2023 16:59:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 374CC8D0064; Wed, 13 Dec 2023 16:59:03 -0500 (EST) 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 23F968D0062 for ; Wed, 13 Dec 2023 16:59:03 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id E840F1A0116 for ; Wed, 13 Dec 2023 21:59:02 +0000 (UTC) X-FDA: 81563160924.24.865ECC4 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf26.hostedemail.com (Postfix) with ESMTP id B167514001A for ; Wed, 13 Dec 2023 21:59:00 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=J+8Kg4JE; dmarc=none; spf=none (imf26.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702504741; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=cycVRug3BXZ7xnSyei6e0LRSUicnPdbBpgBQ/Dl2tkc=; b=CgWfG/kkdHl8RliHI+vpbGmKKmyqtL9mod1p0q12TvN8Pj955OpXlB23VhdDt8vKXIzdHZ TXMHqZUzoyroYjUrffLeFz8Xsag7QAnFOH6kXz1ZIBXbghJiN7kLvBnevVpPl8mX2KTfu5 2VJSqlT8gFi164eo9OttJsyRP0H1oEA= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=J+8Kg4JE; dmarc=none; spf=none (imf26.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702504741; a=rsa-sha256; cv=none; b=mruYEsIuL0HiEhnUvGmC1ZzDUqD4XiQ2fGwnzohZngkiMAIO479f3/b3KSpTipdoehRtwO ZW5PRAouJHnMwN0PBr/LJdjplronTX3wG3H3O8/3Zi33wWwhYdZiydVt580uORpPnBTqI8 yccKdhm1SZF4tusA6wuvsxcd+8zSpeI= 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=cycVRug3BXZ7xnSyei6e0LRSUicnPdbBpgBQ/Dl2tkc=; b=J+8Kg4JE6iq6EkIJUz+R2TIZmr ihtRoobszxm3k98bukYMYbxRLgncWKf74COSc0hOmqTRS3mJrWkgB8biMqy9KWOanBqtJOAgBq6t9 DnmN1Wsx/JmtTfkNfRYAnuAXFq6NX02GjBQU1p10kxEQFyVhcvFb74QiC0eaBywuLtFkEnPp7LHqq +bXZBJwlG5LDgarDVnFidW477Qpf1P0FJnUke0oHJIlHk7OFyi7JzjX9oK9gowhs7BSOhBxFdN9l1 Req6S8DBJI9VFTZweIBYPJkBxdFP3F2BEwlq4T07w+Etd0iPffzM1cd62b2qpb7TUZfmh/DoKJIPF VBhGvBbA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rDXFd-002oiZ-TR; Wed, 13 Dec 2023 21:58:45 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 09/13] mm: Convert swap_page_sector() to swap_folio_sector() Date: Wed, 13 Dec 2023 21:58:38 +0000 Message-Id: <20231213215842.671461-10-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20231213215842.671461-1-willy@infradead.org> References: <20231213215842.671461-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: B167514001A X-Stat-Signature: fah3yb5qfub19smiccb3fjtq6a3tnmbq X-HE-Tag: 1702504740-27090 X-HE-Meta: U2FsdGVkX1/8nF/o9Y7oJgfOJqx1E6OVtPWHxfbn6VrU8Bz4SD153ymXKbLzmm4SXWG41J5hJX5e5QSzV8G7q4eLR7fMIjiX7QJY7Zo4pS/7vO0ZV3gwQb95U9Ah+BXB9RR3JGQ066YiYUyT+iqf0tfkuNI4tosiPP4tlewoyCTAR9a1PpGqr1ZLuOcUeJNiUkhLNN1E+f3yMlY5PhQiBAiitvqYzqFBs9UsawlWyMtTHyEobXHt25wosw4cJl5G8gUifB/MUKAlOhHeFYifKSY03fNcyMYm7A3V3rD4NNKh9ezmAxW3zSNkmHHv/9dSHA6ag++jLOvrA/u5P1yVeE8z0txEBJZkagvdI4j8nnTNQiSLx3UAA9GKo/otxowiGccE9tpF0tLj1mKylDsSAj/G+VxL3UyMgFZFVnv2mhVuT4ZWS0mZGbuJglQW+k/gIO7VuAu9l2n856nEvkFmWg8YC8nlXqtGiebnNkzDfNMrR4+qaveBmVqysjHgzXuaP5Q2GEQNhG4I3Tf8hG3k0D1n8tMuTt/lL4P7gh2GjBd1yNWhH2FwIN6agB2RuvgwyQFHDDMFQnvw6t8lpwWXI3W6D3WHXOMEZsvaa/yFuKdTep0JXFUNW5UKgNRfgQNXF6OLLFVxGk4hTzIq+ddzlopMOWeevwPcbcuGNc5o3sMXDXSgcQNVgmZtghDpAxULwVyd2YbR/0jG0DE0AZ6YsBqJjLStqbVT4gFqMNoOHuWjlt/vI8CzP/F1zmx2re4Y/QNVQ03e8YLxx98Az5u3St97MeHpT4ObVab6lqfvJGm1C4ZePWOp4Ehf/DF9HVXwZasjw48hNkafdhAkLW3fzBHHomY+BTN2EfyfYZFju5eVny2gXtZlu1EI7xOvtQduyHELENYR4UaXdPjPwtaEqWdRv0Jaohf/RHBDt/T8nx45t45j/YHnGDfsTckkIxxi2Gsoc2yzUg3LyXqf0cO KMyVQrVK NiDBdbljIm9d5knLe7/aUpqpksbVQGyFjDskFdY567Rl9EpmBFoIcbXgcmJ7zEM/A1EUAhKtgcoDltgo6NajoSjxTeztPp6IW3E1x5hJxnOR0S5gqM53FVohECyLDpS89zRBjBcf6u5nb0ajZGSKiRPPPhXdU3K66ogh9Ypfyl6ZYe8OtVQD9ZwEuTa9h48itGIKn7UOCU2R90Qq8RVMz6/b47YP6aJCmFy2/ 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: List-Subscribe: List-Unsubscribe: All callers have a folio, so pass it in. Saves a couple of calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/swap.h | 2 +- mm/page_io.c | 8 ++++---- mm/swapfile.c | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index edc0f2c8ce01..77c43715ad5b 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -493,7 +493,7 @@ struct backing_dev_info; extern int init_swap_address_space(unsigned int type, unsigned long nr_pages); extern void exit_swap_address_space(unsigned int type); extern struct swap_info_struct *get_swap_device(swp_entry_t entry); -sector_t swap_page_sector(struct page *page); +sector_t swap_folio_sector(struct folio *folio); static inline void put_swap_device(struct swap_info_struct *si) { diff --git a/mm/page_io.c b/mm/page_io.c index e18afcd9c19a..6736c56526bf 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -334,7 +334,7 @@ static void swap_writepage_bdev_sync(struct folio *folio, bio_init(&bio, sis->bdev, &bv, 1, REQ_OP_WRITE | REQ_SWAP | wbc_to_write_flags(wbc)); - bio.bi_iter.bi_sector = swap_page_sector(&folio->page); + bio.bi_iter.bi_sector = swap_folio_sector(folio); bio_add_folio_nofail(&bio, folio, folio_size(folio), 0); bio_associate_blkg_from_page(&bio, folio); @@ -355,7 +355,7 @@ static void swap_writepage_bdev_async(struct folio *folio, bio = bio_alloc(sis->bdev, 1, REQ_OP_WRITE | REQ_SWAP | wbc_to_write_flags(wbc), GFP_NOIO); - bio->bi_iter.bi_sector = swap_page_sector(&folio->page); + bio->bi_iter.bi_sector = swap_folio_sector(folio); bio->bi_end_io = end_swap_bio_write; bio_add_folio_nofail(bio, folio, folio_size(folio), 0); @@ -461,7 +461,7 @@ static void swap_readpage_bdev_sync(struct folio *folio, struct bio bio; bio_init(&bio, sis->bdev, &bv, 1, REQ_OP_READ); - bio.bi_iter.bi_sector = swap_page_sector(&folio->page); + bio.bi_iter.bi_sector = swap_folio_sector(folio); bio_add_folio_nofail(&bio, folio, folio_size(folio), 0); /* * Keep this task valid during swap readpage because the oom killer may @@ -480,7 +480,7 @@ static void swap_readpage_bdev_async(struct folio *folio, struct bio *bio; bio = bio_alloc(sis->bdev, 1, REQ_OP_READ, GFP_KERNEL); - bio->bi_iter.bi_sector = swap_page_sector(&folio->page); + bio->bi_iter.bi_sector = swap_folio_sector(folio); bio->bi_end_io = end_swap_bio_read; bio_add_folio_nofail(bio, folio, folio_size(folio), 0); count_vm_event(PSWPIN); diff --git a/mm/swapfile.c b/mm/swapfile.c index 1501bc956456..b22c47b11d65 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -227,14 +227,14 @@ offset_to_swap_extent(struct swap_info_struct *sis, unsigned long offset) BUG(); } -sector_t swap_page_sector(struct page *page) +sector_t swap_folio_sector(struct folio *folio) { - struct swap_info_struct *sis = page_swap_info(page); + struct swap_info_struct *sis = swp_swap_info(folio->swap); struct swap_extent *se; sector_t sector; pgoff_t offset; - offset = __page_file_index(page); + offset = swp_offset(folio->swap); se = offset_to_swap_extent(sis, offset); sector = se->start_block + (offset - se->start_page); return sector << (PAGE_SHIFT - 9); From patchwork Wed Dec 13 21:58:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13491926 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 4F3F7C4332F for ; Wed, 13 Dec 2023 21:59:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B17838D0060; Wed, 13 Dec 2023 16:58:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AC8128D0062; Wed, 13 Dec 2023 16:58:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 80E928D0060; Wed, 13 Dec 2023 16:58:55 -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 5AD708D0062 for ; Wed, 13 Dec 2023 16:58:55 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 27EA8A1D7F for ; Wed, 13 Dec 2023 21:58:55 +0000 (UTC) X-FDA: 81563160630.22.E4E0A72 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf12.hostedemail.com (Postfix) with ESMTP id C449B40012 for ; Wed, 13 Dec 2023 21:58:52 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="TM9Z/QTl"; spf=none (imf12.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702504733; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ZmqyJYgvy399iQ2pmkRbX729RSnA28LX1k0f/kHnhWc=; b=vyb4A85Tn5sf6/1zUJN5+wtqB+xIAqW7ullFDlW6A5ezyhjVylNbUVIAllG7qFM8m1FEgG tRDX2ArmCoabRmmD5pIskzOPKwzKsvdigq6NPmuXbf7Uk6N//+6Sm0fvHsIPU8h1H0KkA1 TaMKrSz9h2p7z4h2hoRKC6AZilpa7Eg= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="TM9Z/QTl"; spf=none (imf12.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702504733; a=rsa-sha256; cv=none; b=3MFv8DDLR5MdBHK/dLMFKfDBXDNv5HL4Z/FNJ0A5y1kkFoAPpBT978XM6Utmrhgm8b3gBR MA/1fqbotzYGFXJstpvWicza3hNinPrJoZhcQc1RwKDifuCqrilRyz5LXX+uPdTbX00jCN RS3j6WJ+tIdXveSfl1/AljFR0uGTOCc= 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=ZmqyJYgvy399iQ2pmkRbX729RSnA28LX1k0f/kHnhWc=; b=TM9Z/QTlcFwx14ESiTSPzq9T1j pls0KXtivPO21UVMwAgnP5t+Np6h4ZMfXiForNf7vSoVybgtwf31FdRgfhoSHs2a0eN4S8iglqvO5 3uF+w9tNuQz7ybtMSMHE6nr+b6QHtffne6rKIUrcvBsWRdyDRS/OKlwP4HXpQ7dQKTv7QoPtaSrcm 4iU8zQAcb8fOdlIBEqtBUOjx9kQMr00FUxdLNocV8/MwYFmmRkOLwRt3WOhCL/6ZU2M+7rlinl3KC XprzXJdrdvegnIhhyn2UnPsKyNzrYfgQVeIeJgdxHlfjLRhkpOaMRzJC01YA+CM3rSykr/O8Df8uh dveVke0Q==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rDXFd-002oib-WA; Wed, 13 Dec 2023 21:58:46 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 10/13] mm: Convert swap_readpage() to swap_read_folio() Date: Wed, 13 Dec 2023 21:58:39 +0000 Message-Id: <20231213215842.671461-11-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20231213215842.671461-1-willy@infradead.org> References: <20231213215842.671461-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: C449B40012 X-Rspam-User: X-Stat-Signature: 8c5bfuncct3p641mezm8ik7hnhy7o5qc X-Rspamd-Server: rspam01 X-HE-Tag: 1702504732-616529 X-HE-Meta: U2FsdGVkX19M5WB9mlaoDeojpZhKT+i4ByQoSonL+/SWFdi8+f28rcw19SOqwjrN5+oLEer03TOeUs4XZOa8Gp71vZoBt5ShIPByzqEMEHn8MNBfaJG7usuU4C27mb67SPuabJcK6ppvDDbiTMjhKs2XM9FTe/oj2ycCEtwOJoqJ1oh3KlQWvQ45VdNu2mKz3Lmc1aEC33iSQiXVt2W/7ITi/RLc47sY3bUZ7d86JveVrIUeIHcyINF14TDyOJE3KCihuqf2KyCoMF8Ul9UTp8e/ySAf5VDLJ/MOiQgwjZ8hYSSweT161gVHg7JZHZXaiPmlKpgBvxa6LuIXQgGe94Wpbm1ZX+9cyik7suD6W3ePSK0sAbEMezCa2vPXdbdK0VwC5ydGunEttOKSDwXKTc7mBExm/mSUsrJVvnCdJF3eG1apKEjXRiUxXm/1k4M2H7w3T8h2y6yDUV4LiCItv9Cqg40R5eiOXGgvHrRq97lkvESXR4MfdmVNdi2qnSrUxrMSpkD6yV04Y9zK+vEzwOGS2vh1SC81RSqQTF6SNDcMgKHni8YJvHHbci1GK99lj/iKy0YMYhG/wVnrhJwm7G+1DNwR+hSPeXRgr5LAVQ1JbbHipeWdkSlTkBQ1bxGUkVua5/SCvQYCzeBGRK9ip7SsDobdjh2f17wA5ZDjjreH2d2vkrKlaPQ60xa683shwEyVmB2SZzHfkf7hRS6M962z+B4C7mE2cRSt9iNK1G9KOBgx5luKieJ4ZZIlT9p8GD4gxjhdjptiOVRd2/wPpQD5xO1pxwM1ZmydWgRJEyVmAtEJVoJDlyJNSN2yLRhG/gxIKbhSnh1BTL3YlqVE2U0fuQEwJSVZpnLHYFVTIyj31nyGLDwQTtw5AA4ZSHLvYEItnLRStSYXkzzarbKfvTdP745bv+KQzXoUEUqiVY3/5WT8O9FUUmrQgYEG5E8fr5epduEaGPvnY+XZCU8 XscfwKDz yK8WX4vG/Hsn4CnPRDIcAYLOfHPbYfEwbh9DAI4nuXqefCNU+I6a+gjcpqirNSzi+l15ZG5IINK+8fLJphJBnEIHte9o1F5n3AbhxFeMrRQcZ+ZRsGm5ADoxsAgzCRVjW3ZksSdNU4fDfg58cWgJddibEcVA1suyuusHst2HNfMHzp9Sc5/zIqIo5ykl6k8bE0Qa77SUmft6WUrTtsivuAl+V47T6wKggvPhz 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: List-Subscribe: List-Unsubscribe: All callers have a folio, so pass it in, saving two calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- mm/memory.c | 4 ++-- mm/page_io.c | 18 +++++++++--------- mm/swap.h | 5 +++-- mm/swap_state.c | 12 ++++++------ mm/swapfile.c | 2 +- 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index e402340e3f46..2f7b212b7d71 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3882,9 +3882,9 @@ vm_fault_t do_swap_page(struct vm_fault *vmf) folio_add_lru(folio); - /* To provide entry to swap_readpage() */ + /* To provide entry to swap_read_folio() */ folio->swap = entry; - swap_readpage(page, true, NULL); + swap_read_folio(folio, true, NULL); folio->private = NULL; } } else { diff --git a/mm/page_io.c b/mm/page_io.c index 6736c56526bf..09c6a4f316f3 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -420,7 +420,7 @@ static void sio_read_complete(struct kiocb *iocb, long ret) mempool_free(sio, sio_pool); } -static void swap_readpage_fs(struct folio *folio, struct swap_iocb **plug) +static void swap_read_folio_fs(struct folio *folio, struct swap_iocb **plug) { struct swap_info_struct *sis = swp_swap_info(folio->swap); struct swap_iocb *sio = NULL; @@ -454,7 +454,7 @@ static void swap_readpage_fs(struct folio *folio, struct swap_iocb **plug) *plug = sio; } -static void swap_readpage_bdev_sync(struct folio *folio, +static void swap_read_folio_bdev_sync(struct folio *folio, struct swap_info_struct *sis) { struct bio_vec bv; @@ -474,7 +474,7 @@ static void swap_readpage_bdev_sync(struct folio *folio, put_task_struct(current); } -static void swap_readpage_bdev_async(struct folio *folio, +static void swap_read_folio_bdev_async(struct folio *folio, struct swap_info_struct *sis) { struct bio *bio; @@ -487,10 +487,10 @@ static void swap_readpage_bdev_async(struct folio *folio, submit_bio(bio); } -void swap_readpage(struct page *page, bool synchronous, struct swap_iocb **plug) +void swap_read_folio(struct folio *folio, bool synchronous, + struct swap_iocb **plug) { - struct folio *folio = page_folio(page); - struct swap_info_struct *sis = page_swap_info(page); + struct swap_info_struct *sis = swp_swap_info(folio->swap); bool workingset = folio_test_workingset(folio); unsigned long pflags; bool in_thrashing; @@ -514,11 +514,11 @@ void swap_readpage(struct page *page, bool synchronous, struct swap_iocb **plug) folio_mark_uptodate(folio); folio_unlock(folio); } else if (data_race(sis->flags & SWP_FS_OPS)) { - swap_readpage_fs(folio, plug); + swap_read_folio_fs(folio, plug); } else if (synchronous || (sis->flags & SWP_SYNCHRONOUS_IO)) { - swap_readpage_bdev_sync(folio, sis); + swap_read_folio_bdev_sync(folio, sis); } else { - swap_readpage_bdev_async(folio, sis); + swap_read_folio_bdev_async(folio, sis); } if (workingset) { diff --git a/mm/swap.h b/mm/swap.h index b81587740cf1..859ae8f0fd2d 100644 --- a/mm/swap.h +++ b/mm/swap.h @@ -10,7 +10,8 @@ struct mempolicy; /* linux/mm/page_io.c */ int sio_pool_init(void); struct swap_iocb; -void swap_readpage(struct page *page, bool do_poll, struct swap_iocb **plug); +void swap_read_folio(struct folio *folio, bool do_poll, + struct swap_iocb **plug); void __swap_read_unplug(struct swap_iocb *plug); static inline void swap_read_unplug(struct swap_iocb *plug) { @@ -63,7 +64,7 @@ static inline unsigned int folio_swap_flags(struct folio *folio) } #else /* CONFIG_SWAP */ struct swap_iocb; -static inline void swap_readpage(struct page *page, bool do_poll, +static inline void swap_read_folio(struct folio *folio, bool do_poll, struct swap_iocb **plug) { } diff --git a/mm/swap_state.c b/mm/swap_state.c index d4e25d9b5dc6..efff7148a59d 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -539,7 +539,7 @@ struct folio *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, * the swap entry is no longer in use. * * get/put_swap_device() aren't needed to call this function, because - * __read_swap_cache_async() call them and swap_readpage() holds the + * __read_swap_cache_async() call them and swap_read_folio() holds the * swap cache folio lock. */ struct page *read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, @@ -557,7 +557,7 @@ struct page *read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, mpol_cond_put(mpol); if (page_allocated) - swap_readpage(&folio->page, false, plug); + swap_read_folio(folio, false, plug); return folio_file_page(folio, swp_offset(entry)); } @@ -674,7 +674,7 @@ struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask, if (!folio) continue; if (page_allocated) { - swap_readpage(&folio->page, false, &splug); + swap_read_folio(folio, false, &splug); if (offset != entry_offset) { folio_set_readahead(folio); count_vm_event(SWAP_RA); @@ -690,7 +690,7 @@ struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask, folio = __read_swap_cache_async(entry, gfp_mask, mpol, ilx, &page_allocated, false); if (unlikely(page_allocated)) - swap_readpage(&folio->page, false, NULL); + swap_read_folio(folio, false, NULL); zswap_folio_swapin(folio); return folio_file_page(folio, swp_offset(entry)); } @@ -848,7 +848,7 @@ static struct page *swap_vma_readahead(swp_entry_t targ_entry, gfp_t gfp_mask, if (!folio) continue; if (page_allocated) { - swap_readpage(&folio->page, false, &splug); + swap_read_folio(folio, false, &splug); if (i != ra_info.offset) { folio_set_readahead(folio); count_vm_event(SWAP_RA); @@ -866,7 +866,7 @@ static struct page *swap_vma_readahead(swp_entry_t targ_entry, gfp_t gfp_mask, folio = __read_swap_cache_async(targ_entry, gfp_mask, mpol, targ_ilx, &page_allocated, false); if (unlikely(page_allocated)) - swap_readpage(&folio->page, false, NULL); + swap_read_folio(folio, false, NULL); zswap_folio_swapin(folio); return folio_file_page(folio, swp_offset(entry)); } diff --git a/mm/swapfile.c b/mm/swapfile.c index b22c47b11d65..f3e23a3d26ae 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -2225,7 +2225,7 @@ EXPORT_SYMBOL_GPL(add_swap_extent); /* * A `swap extent' is a simple thing which maps a contiguous range of pages * onto a contiguous range of disk blocks. A rbtree of swap extents is - * built at swapon time and is then used at swap_writepage/swap_readpage + * built at swapon time and is then used at swap_writepage/swap_read_folio * time for locating where on disk a page belongs. * * If the swapfile is an S_ISBLK block device, a single extent is installed. From patchwork Wed Dec 13 21:58:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13491925 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 3EF85C4167D for ; Wed, 13 Dec 2023 21:59:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 723048D0049; Wed, 13 Dec 2023 16:58:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 61B2E8D0063; Wed, 13 Dec 2023 16:58:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3296D8D0060; Wed, 13 Dec 2023 16:58:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 180F28D0049 for ; Wed, 13 Dec 2023 16:58:55 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id DF5D8160120 for ; Wed, 13 Dec 2023 21:58:54 +0000 (UTC) X-FDA: 81563160588.21.A653BA0 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf07.hostedemail.com (Postfix) with ESMTP id 42C114001F for ; Wed, 13 Dec 2023 21:58:52 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=oOTferP1; dmarc=none; spf=none (imf07.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702504733; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=RkqEnzS+hsG7DLgofF6q6jsv7l6fWtgv0ou350gPTRk=; b=OUFSv6rUR07A7fhW3Rz6NDaMC9vvEprvIhNM6zuuaXC9qXCknh7FZLpBP9cEohP9zdyB4P +sKXEncgX+K9nnjQo8cHHnUKGulT3RtC0ZPxkE2MXjZbiaJbh7tZ6bcxJV/9r/+eKwQzLf kjJStzUNY8cz022e/tvcpnSGjWTbljo= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=oOTferP1; dmarc=none; spf=none (imf07.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702504733; a=rsa-sha256; cv=none; b=oUKJ3dzYHV97KEM5WE8eXO7Pf5xa86FZDXdZvTect4m7YvcYYGBjpwhmJVNpTiAyr0USBh CELpEuMQK8q0S9Ar9aX40pEX634Fbuvs2gUpH3sUsfsp8V60up5rDmb0xQBZLJHAhOMh5a FBscxAnGY8VvCHYP4j4bAKoVNxoHpD4= 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=RkqEnzS+hsG7DLgofF6q6jsv7l6fWtgv0ou350gPTRk=; b=oOTferP13dWV3cp8hCJKnOFHhq 6dbZcysU3BPRsaHbTtGWbSyP8ffP8OYZqinAIIK9awmzbeRXtLUxa2qSuRCbz+DuLxXU3XFhJbpeH r00goynIRsyUYAaOMch+7en5oa8fV7zXEqTQXn5gY5KF0mC8FdbdqrLJhczq4v7y4lmWDZx0+wxO4 Xlf49ypcu9kUcp5cVAevjq2XeZuFtXQfs1YaTccs86ghMMW8h8vlbcGc5pffLcPgnN8oJ+z/WNxAV s9ICsbBcTpa9AsstnC5IH9bvGG3akMt4ZdNzJawLd2C3Iq2HVKVvzkiMYYhwpBq6f0g/ZBEyq76a2 VbOSOcqw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rDXFe-002oid-2r; Wed, 13 Dec 2023 21:58:46 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 11/13] mm: Remove page_swap_info() Date: Wed, 13 Dec 2023 21:58:40 +0000 Message-Id: <20231213215842.671461-12-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20231213215842.671461-1-willy@infradead.org> References: <20231213215842.671461-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 42C114001F X-Stat-Signature: ash75s1i8yarsng8sy3rdsqb6mxgpnt3 X-HE-Tag: 1702504732-113392 X-HE-Meta: U2FsdGVkX18RRVPrBz8SeOB94LzALKaKJH7O/K+7GBmq5Nz/Ik7QAtW6zwRZ24s6sqZOWBWvOfG4zWyGNJLPMe39HxnNsoXeYh1YeKzdhEDi4yYQtVq0SxEJh1ojx0YrBZ1XSI5+OgauYj24VcWz7gYo5cn2pLavKBJOFHWSbhx6RZkon1vElBCxJl+okqRZhgORN1ANrtT/An7zVvn0SQ3sGbKgTjOkPkAB4HzdQaI38WMUl0VN6Hxd3EKS9fcj0TEwYxLqbe4knuYzYPfZQn+tSwVF7fyg2N7jyFIpCJG0S0nBakXe0iiqoZiqb9iVmt+TVryqY1w4aRyYuSOyLVPbrIVBzRKSUtGdYjvAEudh/Ezlz/6pWw5Q1GG+r20b6gDlel4lD75zy9ynuO4rMcaaf+bHbfnrlhwzIrTHFU9VzbxOUmC1AaSb53TvzCVNpZKbSbIxEFk/mtumSx+SV+VPo6EgC+Rvuy70Q0P84OXihqQJtqP/UbADUssZTze3BffDN9dp3PSKllMBR+REQiq1Nb25hYJHzhmzAwRPh8MnN5aa1i+CiBKgA9CGdu6/Y0TLgrgiWQy7n2yJtSBRQHYI54RXZwvTKWCt3xs5thaFLCnBQKyXU/EO+PKqJnwyNRdYKfiZ5+7HOZWmqUW0Yge5e1sg3r5rrjXK6uhTqIxO+Fq4BPFX+CYVDB3Dif4e98WKBYFLVB8W3WwT5Wr0madZbDoDwoz+qiQeQRT6/z/q85iL9mKAcUyYX6LC52i05PN+8ENnuWzjZDBUZJVaNa8gmWk1FbdG5Wy/WUukQ8bO+CEQPTbBQuNK30n6OyCFdQaOructBN35SBu1hGKWL+DK/cHQdvecdbCLnKTo0Q+eBRea1vrzDehYpGn+3AgI+ggP7OgVzcprQltnxkKIE6E19QitTHVdDD8JnliJJsPmx2zeYgJzkJNVR2Tvcb8DP34GsFxX2jVxo4L8GQk 4MFQupTL SfdZBx11nwxuctFOjwRCVbVHwl5xzk5FP33GbThn0/gcRnmFZxq5gMhurjGufgRcyoVjpxUPzhP/M9CZ00pJcFD6xXLRwYcLsmyk3groRbwILLlDwHEI3+8QBieexOHS9ToZpgTa+1P54+Cn3Qt/zX6MH1RhSg1YZ+1X8MXZlE4NzldcqXiCP9oPLDQdEC2k0trn+LNqMfM0gss8Ncbv70HUVuQ3XzNjFkrwi 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: List-Subscribe: List-Unsubscribe: It's more efficient to get the swap_info_struct by calling swp_swap_info() directly. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/swap.h | 3 +-- mm/swap.h | 2 +- mm/swapfile.c | 8 +------- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index 77c43715ad5b..fac9b80b5e32 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -487,8 +487,7 @@ extern sector_t swapdev_block(int, pgoff_t); extern int __swap_count(swp_entry_t entry); extern int swap_swapcount(struct swap_info_struct *si, swp_entry_t entry); extern int swp_swapcount(swp_entry_t entry); -extern struct swap_info_struct *page_swap_info(struct page *); -extern struct swap_info_struct *swp_swap_info(swp_entry_t entry); +struct swap_info_struct *swp_swap_info(swp_entry_t entry); struct backing_dev_info; extern int init_swap_address_space(unsigned int type, unsigned long nr_pages); extern void exit_swap_address_space(unsigned int type); diff --git a/mm/swap.h b/mm/swap.h index 859ae8f0fd2d..6bf25342589f 100644 --- a/mm/swap.h +++ b/mm/swap.h @@ -60,7 +60,7 @@ struct page *swapin_readahead(swp_entry_t entry, gfp_t flag, static inline unsigned int folio_swap_flags(struct folio *folio) { - return page_swap_info(&folio->page)->flags; + return swp_swap_info(folio->swap)->flags; } #else /* CONFIG_SWAP */ struct swap_iocb; diff --git a/mm/swapfile.c b/mm/swapfile.c index f3e23a3d26ae..2f877ca44513 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -3369,18 +3369,12 @@ struct swap_info_struct *swp_swap_info(swp_entry_t entry) return swap_type_to_swap_info(swp_type(entry)); } -struct swap_info_struct *page_swap_info(struct page *page) -{ - swp_entry_t entry = page_swap_entry(page); - return swp_swap_info(entry); -} - /* * out-of-line methods to avoid include hell. */ struct address_space *swapcache_mapping(struct folio *folio) { - return page_swap_info(&folio->page)->swap_file->f_mapping; + return swp_swap_info(folio->swap)->swap_file->f_mapping; } EXPORT_SYMBOL_GPL(swapcache_mapping); From patchwork Wed Dec 13 21:58:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13491924 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 42070C4332F for ; Wed, 13 Dec 2023 21:59:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 467C78D0061; Wed, 13 Dec 2023 16:58:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3C43C8D0049; Wed, 13 Dec 2023 16:58:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1C84B8D0061; Wed, 13 Dec 2023 16:58:55 -0500 (EST) 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 EAD708D0060 for ; Wed, 13 Dec 2023 16:58:54 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id BD0CD140271 for ; Wed, 13 Dec 2023 21:58:54 +0000 (UTC) X-FDA: 81563160588.25.BA2B30B Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf08.hostedemail.com (Postfix) with ESMTP id 233F2160013 for ; Wed, 13 Dec 2023 21:58:52 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=TgdNg8zX; dmarc=none; spf=none (imf08.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702504733; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ainsjTNjsZGiXC+tnF20odH8AOu1mlxTdqaBS1jkk5I=; b=iooK+7EYHbiannCmjEs82T3fTuTWCiu5qg5zoajbIwMqvGA9ho0+8H9XMQvInhHb2Ku7jQ AZWSZjOxxMQcFBPBhz0UZKjiS0vicAt6KCB45OdpvIkP64q/J1akNlmfx/gCO704gnG+AX 360oRvGW4YnN4B1SR2CSeq76YzmX3ZY= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=TgdNg8zX; dmarc=none; spf=none (imf08.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702504733; a=rsa-sha256; cv=none; b=XIdQQCnooR+0/VcC6iLQ56wyVRHgUanpXp0vgdGVHsPQWdq/X/uzx1PZh0QJNADSr13Nax 6uXsEj1MokpH0Cg6N3SnqAQctEdyKZVm7fIlUtyPBpDrAtL77sV4mqHC7+bgAm151XHera YhovC65afxtBlJshG+7Hk6K6RWwmBnA= 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=ainsjTNjsZGiXC+tnF20odH8AOu1mlxTdqaBS1jkk5I=; b=TgdNg8zXov8va4OwT+d5Rk7Bi0 w2CkHda7s6cSPIv27eQ2SFskFN1/NgmcJTaX/SvaRovvEcFc8sLrYoPcgAiu4sYeWuvqQGNGa2Vyi dboqHi6gcdt9Z1mI8tqS8IjHskaeFrCkxvDQJTfMAzXesowDD/XsJBAQs3C5LQI6y3+PfU0p3CHaA N2VoeAqr7wtOuVIDN2LLCB2uE0nqNrU8r95/7kMMiYkQQM2oOFAYli+Oqa0UiG+oL55ePDQfb9WXx b1AIDfIlwpHPSGAUuCOZuHoMqLqfrKOCuNxTSYQQH5fCyraJIG55uvfMrodPkh0jx0E1iqrfoZ9oM h8pNA8oQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rDXFe-002oif-5Y; Wed, 13 Dec 2023 21:58:46 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 12/13] mm: Return a folio from read_swap_cache_async() Date: Wed, 13 Dec 2023 21:58:41 +0000 Message-Id: <20231213215842.671461-13-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20231213215842.671461-1-willy@infradead.org> References: <20231213215842.671461-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 233F2160013 X-Stat-Signature: 89m7smnorm1hqkwhuoiw1bcnx6oxtjep X-HE-Tag: 1702504732-496405 X-HE-Meta: U2FsdGVkX18TRyTs934+cckm2irDfdxQe3AWGcr4XBKCuzRvK+ELmjkMinANh+GHwIFoA+GOT2dO6NCc/hMwPAkRBv4+rGVTsnNNoETar43feMXxPyRmIEpf7Q4kG5F2Juc8nOSTehKgm7k6jOBKkGmd6F6BJ3hslbxvJGk9OM0VolpZGTu4qMOADr+gwGB71+HPmh1Ykrd15NezEmav5FHwWarGz/5GArM+CpehyGRTJhnTk2h+DXpWIJPfSvx7OL80QZSeqShaV9W78JQsUJjOeyZpmNTkX899DMFTwWsJTdSM1G9K3e1l2NphV3Vio52s6kdmvQsysoMua4Nx37Suq7NWLq2ip2GhIBbTQNmGw1YoxO/gc5eE4oDs5l49PnDDYRF9p2OcUmlQiHPbwT8pRiEpdw1PFgTRyNpqifGIjIBdIZvxJmjLoFH11F0WI/0dxl7fIsTO69XNyRWmd/bCdklL/ExFMSBL3iJlgs4inVrvlGvJgnMmEjq1MYzWzcJQQTRXS7LtbimSLW1JXS6sBiZgSTGGyEbzaYk6jW2UHTPSaSE9+ePFEJ9/VCW1KtLcBNB3+Bw6JDtcYWeE7VQ+qwa5QXn3Jo51orPmXMyG0vLEfkz9TZiDNOtApTP75WwqE7yJVPdQ4+ptzUtqBdxsTVWZlXyeM0g8+l8aEdoIQ4M5RE9vHu1ElRNcEvGyiybiZauqaVNK+fs8vP8++qkpMkrS1iFoaJqP4XTK4lc0/K1CzRCgVEjm8EJMYEfCGh6GNLLQilwcv7TkSyGIjsgcWC0LJuqmCV4FNPpiteOxWNwVIs91trv/Dz1zie5PDkvm7AgvaVZjgKn29LAlYxMbioEcVzcQThCDRwcoWfNLuv4eDiAfVLQzMmUx7XK5BPzDDZ9bktc52PiJGZqxtKQ3/HDGB8sitn2Vmf2XUF2H05tuNhTSD5Q2liyv/iA3vk1b6h3xTUrjIIpSCHP e3uS7GZd SV6tj6WKKwrv59L3clA6Zix4Cbxhq5XUrxo/torcoApCBKNK+LMuUurueiXpb2FWmQnmzUswH/djTMnmVmbADQq0N0yxJNXTzKxsW+t7KECBtTWhQD9qStxdE10LDSwxi7RtQ85nf2Rf3kGOyJYxNkv4+UpnHP89Tc+VCC0RTQAsnHdk6EmpQFHDZFDVImOxIzHSzGJn/TqAzc3d6PV6ZnjoZ1cvO+rM0Rfib 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: List-Subscribe: List-Unsubscribe: The only two callers simply call put_page() on the page returned, so they're happier calling folio_put(). Saves two calls to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- mm/madvise.c | 22 +++++++++++----------- mm/swap.h | 7 +++---- mm/swap_state.c | 8 ++++---- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/mm/madvise.c b/mm/madvise.c index 6214a1ab5654..912155a94ed5 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -180,7 +180,7 @@ static int swapin_walk_pmd_entry(pmd_t *pmd, unsigned long start, for (addr = start; addr < end; addr += PAGE_SIZE) { pte_t pte; swp_entry_t entry; - struct page *page; + struct folio *folio; if (!ptep++) { ptep = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); @@ -198,10 +198,10 @@ static int swapin_walk_pmd_entry(pmd_t *pmd, unsigned long start, pte_unmap_unlock(ptep, ptl); ptep = NULL; - page = read_swap_cache_async(entry, GFP_HIGHUSER_MOVABLE, + folio = read_swap_cache_async(entry, GFP_HIGHUSER_MOVABLE, vma, addr, &splug); - if (page) - put_page(page); + if (folio) + folio_put(folio); } if (ptep) @@ -223,17 +223,17 @@ static void shmem_swapin_range(struct vm_area_struct *vma, { XA_STATE(xas, &mapping->i_pages, linear_page_index(vma, start)); pgoff_t end_index = linear_page_index(vma, end) - 1; - struct page *page; + struct folio *folio; struct swap_iocb *splug = NULL; rcu_read_lock(); - xas_for_each(&xas, page, end_index) { + xas_for_each(&xas, folio, end_index) { unsigned long addr; swp_entry_t entry; - if (!xa_is_value(page)) + if (!xa_is_value(folio)) continue; - entry = radix_to_swp_entry(page); + entry = radix_to_swp_entry(folio); /* There might be swapin error entries in shmem mapping. */ if (non_swap_entry(entry)) continue; @@ -243,10 +243,10 @@ static void shmem_swapin_range(struct vm_area_struct *vma, xas_pause(&xas); rcu_read_unlock(); - page = read_swap_cache_async(entry, mapping_gfp_mask(mapping), + folio = read_swap_cache_async(entry, mapping_gfp_mask(mapping), vma, addr, &splug); - if (page) - put_page(page); + if (folio) + folio_put(folio); rcu_read_lock(); } diff --git a/mm/swap.h b/mm/swap.h index 6bf25342589f..82c68ccb5ab1 100644 --- a/mm/swap.h +++ b/mm/swap.h @@ -46,10 +46,9 @@ struct folio *swap_cache_get_folio(swp_entry_t entry, struct folio *filemap_get_incore_folio(struct address_space *mapping, pgoff_t index); -struct page *read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, - struct vm_area_struct *vma, - unsigned long addr, - struct swap_iocb **plug); +struct folio *read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, + struct vm_area_struct *vma, unsigned long addr, + struct swap_iocb **plug); struct folio *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_flags, struct mempolicy *mpol, pgoff_t ilx, bool *new_page_allocated, bool skip_if_exists); diff --git a/mm/swap_state.c b/mm/swap_state.c index efff7148a59d..1cb1d5d0583e 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -542,9 +542,9 @@ struct folio *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, * __read_swap_cache_async() call them and swap_read_folio() holds the * swap cache folio lock. */ -struct page *read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, - struct vm_area_struct *vma, - unsigned long addr, struct swap_iocb **plug) +struct folio *read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, + struct vm_area_struct *vma, unsigned long addr, + struct swap_iocb **plug) { bool page_allocated; struct mempolicy *mpol; @@ -558,7 +558,7 @@ struct page *read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, if (page_allocated) swap_read_folio(folio, false, plug); - return folio_file_page(folio, swp_offset(entry)); + return folio; } static unsigned int __swapin_nr_pages(unsigned long prev_offset, From patchwork Wed Dec 13 21:58:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13491923 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 6AE0BC4332F for ; Wed, 13 Dec 2023 21:58:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DFF138D005F; Wed, 13 Dec 2023 16:58:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DAD158D0049; Wed, 13 Dec 2023 16:58:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C26118D005F; Wed, 13 Dec 2023 16:58:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id AD0568D0049 for ; Wed, 13 Dec 2023 16:58:54 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 7C7D31202FB for ; Wed, 13 Dec 2023 21:58:54 +0000 (UTC) X-FDA: 81563160588.27.FF49551 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf13.hostedemail.com (Postfix) with ESMTP id D152B20017 for ; Wed, 13 Dec 2023 21:58:52 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="M/sxx6R0"; spf=none (imf13.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702504732; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Erg+w3ItkaZkmss/nXfSVMDevgkiDiGZXSTd6j2yqnA=; b=3QoTxI8stQfU6PsAMSO6qDmsSidqHlIKEYMtav0ot6tGdy7re8SKH+fReTZ/3Mwsly2tjM i6P2iJuSFdFrLoHEVcMLpyV/cHJFgkeHBEOx/LhsHXkVvJNScZ0Wa1A/KPEp6R9vx51KcM KC9P0TJS3kCtd+4MXc4QUVbI/H3hPWc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702504732; a=rsa-sha256; cv=none; b=AGuio26MCZ35ik4eo/C7yf7NHk7A6NudPQUHod5A+8NhVp1IcM3AdyPNVYCAQaoddHmUAD hts0K6V22EZLHoEumGp/AErX+W3InVhg4ESaAHXdis+PQy+++BPsfrO13WdShYEvDg0cVV csZIQP+3yDLikNzZMS/JcUWFeqdnrgY= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="M/sxx6R0"; spf=none (imf13.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none 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=Erg+w3ItkaZkmss/nXfSVMDevgkiDiGZXSTd6j2yqnA=; b=M/sxx6R03RBzXBeq9j3eCHCeco PFTWqqucfPmIsm37VlmfqUQDU8l+5AU8RhkwUPCNl/8q25Y8UfUZTTgCF06ZbxC69WG6/PKWRC9k8 mQsThMSiEvisjmVrfDRdMhpRzgXumWMPf8wXYfX216ySxd2xwEF+CskWg3rkuXYw6gAnGA7RCI0Xr 2+UiZEhiPqE15hn+m7utjVPNSKQqzBrMCHhox1xhlMaeq/9gWvAtrmYEt1pVPKI4yxUUUVWkDe2Qj YGnq/L8VvFEw/cmo+34uLOLiE6MmG2TAQQ8KZf4eyie3fo+gDAsbJtuI9hMoCeOzb/FRd5kfJQ+5H YJQAzPOA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rDXFe-002oih-8q; Wed, 13 Dec 2023 21:58:46 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 13/13] mm: Convert swap_cluster_readahead and swap_vma_readahead to return a folio Date: Wed, 13 Dec 2023 21:58:42 +0000 Message-Id: <20231213215842.671461-14-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20231213215842.671461-1-willy@infradead.org> References: <20231213215842.671461-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: D152B20017 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: ue8hz41srdyz54xoymob8gpn1bcxxpu6 X-HE-Tag: 1702504732-348072 X-HE-Meta: U2FsdGVkX1+EbyY3fxRXBsEZfRjHge2Ucu7TY0ZCurpeWtp+ooEoIFmye7Jrl35SQ7BsDpmnCe/6XMIteFFmLOeHAYzF8FQGyJf+4/WcFQNYB54bj3IV8dd3cn1SUApTOwXM2mgUeevLo7vLTaezDpB7bESzG7CXZdXpwUFfrnar3F0FXvSznCt7Mrq1uxT53e1ar5u6liQDd05zyOrcxppQohIxqOAHSxsy1A7OzBpqIRiU0Xg9x8FtHfXpqCJRmqwgkEh/iOwtuIxJiSu6IX7qAR4a2qeUdDwCckj812mYitA6kYfCP93EDqONQoiVtNVPcbTP6T9+9K8ZTsmavIdTRSMGmyHtjyenXXS8LdFl4OCx4BvHBvEHfdY+uJzHUtjtrdwofqLlj8QWl2VbpytAiGoRRS5PmdoOP6B/voAGU+XrwwT/olsJYDac6ED/ErIR9NlLEJWDVKJDwY5FNsDsN7qIkQ48csTYQbdHEON/EZnN8ek46h9YWUDtFRQ8dpsyvzvM6WhjkTqYqfsOGZ4rgyVpKk9sRiM0qpct5NnoqBN8yc9v+UMCS1xHiXCWB+AAJBK3O0ZeAOFwaroDcOLkPXueSgSas0+4VV0r4J8ts1qwAk8a3zFR3i+SQpe2gGC4qx1U8phwsPlLD8uhtkwlHcO6ruPjvDM3oa+Ih6r8UJs54v1ynAL5es+dJpQtxt5Y0UEUNktJDtqwLrrtnWPGhFWATlCndLA+2Zwe/QnBxqoU40K8A8KLq8oHigDlwnfabdBEjlgLwDRQidFqmRsPDaeNUuRcaWBXFgBaq1nUraKe/ZTDsSSvFpyGvsQRBMj6wQ7l+lYGU1rAnfhsaXihYx9QB+daD4uR+7Wo2DmW4n7O51vJgHAPUq93hwoRSzPMLdoWLRBnzZSfBpykQ8S2Iaq38RXN4jh4S/A9c8wWWau0CDXGWtpAgBPwD2kjxNvKnVWgtGYVZc/lLuf FV1hcoI2 SbF8XKHe3luMzYk3rO8SQ5Bou/2CZG8C34tjt24Ytq+zYEbzJJep/MDug3ICZTtDLf6wTQpUebZMFn6v5LkMPZQ/yZtPCtdr0j6P1+TKTOJsDIomwK8D5QNbBXm2ASlk14IUH3Mtp4lGYR52hWuR9vohpWl9KxCgY2WntQista+gKzfLFOxc5FiYSZtYolkAZg/Cz6hRFMdITukyMu4Kakmsl4XtNdAC5nFQh 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: List-Subscribe: List-Unsubscribe: shmem_swapin_cluster() immediately converts the page back to a folio, and swapin_readahead() may as well call folio_file_page() once instead of having each function call it. Signed-off-by: Matthew Wilcox (Oracle) --- mm/shmem.c | 8 +++----- mm/swap.h | 6 +++--- mm/swap_state.c | 21 ++++++++++----------- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index c62f904ba1ca..a4d388973021 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1570,15 +1570,13 @@ static struct folio *shmem_swapin_cluster(swp_entry_t swap, gfp_t gfp, { struct mempolicy *mpol; pgoff_t ilx; - struct page *page; + struct folio *folio; mpol = shmem_get_pgoff_policy(info, index, 0, &ilx); - page = swap_cluster_readahead(swap, gfp, mpol, ilx); + folio = swap_cluster_readahead(swap, gfp, mpol, ilx); mpol_cond_put(mpol); - if (!page) - return NULL; - return page_folio(page); + return folio; } /* diff --git a/mm/swap.h b/mm/swap.h index 82c68ccb5ab1..758c46ca671e 100644 --- a/mm/swap.h +++ b/mm/swap.h @@ -52,8 +52,8 @@ struct folio *read_swap_cache_async(swp_entry_t entry, gfp_t gfp_mask, struct folio *__read_swap_cache_async(swp_entry_t entry, gfp_t gfp_flags, struct mempolicy *mpol, pgoff_t ilx, bool *new_page_allocated, bool skip_if_exists); -struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t flag, - struct mempolicy *mpol, pgoff_t ilx); +struct folio *swap_cluster_readahead(swp_entry_t entry, gfp_t flag, + struct mempolicy *mpol, pgoff_t ilx); struct page *swapin_readahead(swp_entry_t entry, gfp_t flag, struct vm_fault *vmf); @@ -80,7 +80,7 @@ static inline void show_swap_cache_info(void) { } -static inline struct page *swap_cluster_readahead(swp_entry_t entry, +static inline struct folio *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask, struct mempolicy *mpol, pgoff_t ilx) { return NULL; diff --git a/mm/swap_state.c b/mm/swap_state.c index 1cb1d5d0583e..793b5b9e4f96 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -629,7 +629,7 @@ static unsigned long swapin_nr_pages(unsigned long offset) * @mpol: NUMA memory allocation policy to be applied * @ilx: NUMA interleave index, for use only when MPOL_INTERLEAVE * - * Returns the struct page for entry and addr, after queueing swapin. + * Returns the struct folio for entry and addr, after queueing swapin. * * Primitive swap readahead code. We simply read an aligned block of * (1 << page_cluster) entries in the swap area. This method is chosen @@ -640,7 +640,7 @@ static unsigned long swapin_nr_pages(unsigned long offset) * are used for every page of the readahead: neighbouring pages on swap * are fairly likely to have been swapped out from the same node. */ -struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask, +struct folio *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask, struct mempolicy *mpol, pgoff_t ilx) { struct folio *folio; @@ -692,7 +692,7 @@ struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t gfp_mask, if (unlikely(page_allocated)) swap_read_folio(folio, false, NULL); zswap_folio_swapin(folio); - return folio_file_page(folio, swp_offset(entry)); + return folio; } int init_swap_address_space(unsigned int type, unsigned long nr_pages) @@ -796,7 +796,7 @@ static void swap_ra_info(struct vm_fault *vmf, * @targ_ilx: NUMA interleave index, for use only when MPOL_INTERLEAVE * @vmf: fault information * - * Returns the struct page for entry and addr, after queueing swapin. + * Returns the struct folio for entry and addr, after queueing swapin. * * Primitive swap readahead code. We simply read in a few pages whose * virtual addresses are around the fault address in the same vma. @@ -804,9 +804,8 @@ static void swap_ra_info(struct vm_fault *vmf, * Caller must hold read mmap_lock if vmf->vma is not NULL. * */ -static struct page *swap_vma_readahead(swp_entry_t targ_entry, gfp_t gfp_mask, - struct mempolicy *mpol, pgoff_t targ_ilx, - struct vm_fault *vmf) +static struct folio *swap_vma_readahead(swp_entry_t targ_entry, gfp_t gfp_mask, + struct mempolicy *mpol, pgoff_t targ_ilx, struct vm_fault *vmf) { struct blk_plug plug; struct swap_iocb *splug = NULL; @@ -868,7 +867,7 @@ static struct page *swap_vma_readahead(swp_entry_t targ_entry, gfp_t gfp_mask, if (unlikely(page_allocated)) swap_read_folio(folio, false, NULL); zswap_folio_swapin(folio); - return folio_file_page(folio, swp_offset(entry)); + return folio; } /** @@ -888,14 +887,14 @@ struct page *swapin_readahead(swp_entry_t entry, gfp_t gfp_mask, { struct mempolicy *mpol; pgoff_t ilx; - struct page *page; + struct folio *folio; mpol = get_vma_policy(vmf->vma, vmf->address, 0, &ilx); - page = swap_use_vma_readahead() ? + folio = swap_use_vma_readahead() ? swap_vma_readahead(entry, gfp_mask, mpol, ilx, vmf) : swap_cluster_readahead(entry, gfp_mask, mpol, ilx); mpol_cond_put(mpol); - return page; + return folio_file_page(folio, swp_offset(entry)); } #ifdef CONFIG_SYSFS