linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>, linux-mm@kvack.org
Subject: [PATCH 11/13] mm: Remove page_swap_info()
Date: Wed, 13 Dec 2023 21:58:40 +0000	[thread overview]
Message-ID: <20231213215842.671461-12-willy@infradead.org> (raw)
In-Reply-To: <20231213215842.671461-1-willy@infradead.org>

It's more efficient to get the swap_info_struct by calling
swp_swap_info() directly.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 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);
 
-- 
2.42.0



  parent reply	other threads:[~2023-12-13 21:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-13 21:58 [PATCH 00/13] More swap folio conversions Matthew Wilcox (Oracle)
2023-12-13 21:58 ` [PATCH 01/13] mm: Return the folio from __read_swap_cache_async() Matthew Wilcox (Oracle)
2023-12-13 23:14   ` Andrew Morton
2023-12-13 21:58 ` [PATCH 02/13] mm: Pass a folio to __swap_writepage() Matthew Wilcox (Oracle)
2023-12-13 21:58 ` [PATCH 03/13] mm: Pass a folio to swap_writepage_fs() Matthew Wilcox (Oracle)
2023-12-13 21:58 ` [PATCH 04/13] mm: Pass a folio to swap_writepage_bdev_sync() Matthew Wilcox (Oracle)
2023-12-13 21:58 ` [PATCH 05/13] mm: Pass a folio to swap_writepage_bdev_async() Matthew Wilcox (Oracle)
2023-12-13 21:58 ` [PATCH 06/13] mm: Pass a folio to swap_readpage_fs() Matthew Wilcox (Oracle)
2023-12-13 21:58 ` [PATCH 07/13] mm: Pass a folio to swap_readpage_bdev_sync() Matthew Wilcox (Oracle)
2023-12-13 21:58 ` [PATCH 08/13] mm: Pass a folio to swap_readpage_bdev_async() Matthew Wilcox (Oracle)
2023-12-13 21:58 ` [PATCH 09/13] mm: Convert swap_page_sector() to swap_folio_sector() Matthew Wilcox (Oracle)
2023-12-13 21:58 ` [PATCH 10/13] mm: Convert swap_readpage() to swap_read_folio() Matthew Wilcox (Oracle)
2023-12-13 21:58 ` Matthew Wilcox (Oracle) [this message]
2023-12-13 21:58 ` [PATCH 12/13] mm: Return a folio from read_swap_cache_async() Matthew Wilcox (Oracle)
2023-12-13 21:58 ` [PATCH 13/13] mm: Convert swap_cluster_readahead and swap_vma_readahead to return a folio Matthew Wilcox (Oracle)
2023-12-16 13:58   ` Kairui Song
2023-12-20  0:54     ` Matthew Wilcox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231213215842.671461-12-willy@infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox