* [PATCH 1/2] mm: shmem: use 'folio' for shmem_partial_swap_usage()
@ 2025-08-26 9:35 Baolin Wang
2025-08-26 9:35 ` [PATCH 2/2] mm: shmem: drop the unnecessary folio_nr_pages() Baolin Wang
0 siblings, 1 reply; 2+ messages in thread
From: Baolin Wang @ 2025-08-26 9:35 UTC (permalink / raw)
To: akpm, hughd; +Cc: baolin.wang, linux-mm, linux-kernel
It is more straightforward to use the term ‘folio’. No functional changes.
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
mm/shmem.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index a360738ab732..b3c6de84dd27 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1006,15 +1006,15 @@ unsigned long shmem_partial_swap_usage(struct address_space *mapping,
pgoff_t start, pgoff_t end)
{
XA_STATE(xas, &mapping->i_pages, start);
- struct page *page;
+ struct folio *folio;
unsigned long swapped = 0;
unsigned long max = end - 1;
rcu_read_lock();
- xas_for_each(&xas, page, max) {
- if (xas_retry(&xas, page))
+ xas_for_each(&xas, folio, max) {
+ if (xas_retry(&xas, folio))
continue;
- if (xa_is_value(page))
+ if (xa_is_value(folio))
swapped += 1 << xas_get_order(&xas);
if (xas.xa_index == max)
break;
--
2.43.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] mm: shmem: drop the unnecessary folio_nr_pages()
2025-08-26 9:35 [PATCH 1/2] mm: shmem: use 'folio' for shmem_partial_swap_usage() Baolin Wang
@ 2025-08-26 9:35 ` Baolin Wang
0 siblings, 0 replies; 2+ messages in thread
From: Baolin Wang @ 2025-08-26 9:35 UTC (permalink / raw)
To: akpm, hughd; +Cc: baolin.wang, linux-mm, linux-kernel
We've got the number of pages in the folio earlier, thus remove the redundant
folio_nr_pages() function.
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
mm/shmem.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index b3c6de84dd27..f45292bac32d 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2430,7 +2430,6 @@ static int shmem_swapin_folio(struct inode *inode, pgoff_t index,
goto failed;
}
folio_wait_writeback(folio);
- nr_pages = folio_nr_pages(folio);
/*
* Some architectures may have to restore extra metadata to the
--
2.43.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-08-26 9:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-26 9:35 [PATCH 1/2] mm: shmem: use 'folio' for shmem_partial_swap_usage() Baolin Wang
2025-08-26 9:35 ` [PATCH 2/2] mm: shmem: drop the unnecessary folio_nr_pages() Baolin Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).