+ mm-use-a-folio-in-the-softleaf_is_device_private-path.patch added to mm-new branch
Andrew Morton <[email protected]> Mon, 03 Aug 2026 16:09:40 -0700
| Newsgroups | org.kernel.vger.mm-commits |
|---|---|
| Message-ID | <[email protected]> |
The patch titled
Subject: mm: use a folio in the softleaf_is_device_private path
has been added to the -mm mm-new branch. Its filename is
mm-use-a-folio-in-the-softleaf_is_device_private-path.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-use-a-folio-in-the-softleaf_is_device_private-path.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Hongfu Li <[email protected]>
Subject: mm: use a folio in the softleaf_is_device_private path
Date: Mon, 3 Aug 2026 11:15:54 +0800
Use the folio APIs in the device_private migration path of do_swap_page(),
replacing four calls to compound_head() with one.
Link: https://lore.kernel.org/[email protected]
Signed-off-by: Hongfu Li <[email protected]>
Acked-by: David Hildenbrand (Arm) <[email protected]>
Reviewed-by: Lorenzo Stoakes (ARM) <[email protected]>
Reviewed-by: Anshumman Khandual <[email protected]>
Cc: Hongfu Li <[email protected]>
Cc: Liam R. Howlett <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Mike Rapoport <[email protected]>
Cc: Suren Baghdasaryan <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---
mm/memory.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
--- a/mm/memory.c~mm-use-a-folio-in-the-softleaf_is_device_private-path
+++ a/mm/memory.c
@@ -4922,18 +4922,19 @@ vm_fault_t do_swap_page(struct vm_fault
goto unlock;
/*
- * Get a page reference while we know the page can't be
+ * Get a folio reference while we know the folio can't be
* freed.
*/
- if (trylock_page(vmf->page)) {
+ folio = page_folio(vmf->page);
+ if (folio_trylock(folio)) {
struct dev_pagemap *pgmap;
- get_page(vmf->page);
+ folio_get(folio);
pte_unmap_unlock(vmf->pte, vmf->ptl);
pgmap = page_pgmap(vmf->page);
ret = pgmap->ops->migrate_to_ram(vmf);
- unlock_page(vmf->page);
- put_page(vmf->page);
+ folio_unlock(folio);
+ folio_put(folio);
} else {
pte_unmap(vmf->pte);
softleaf_entry_wait_on_locked(entry, vmf->ptl);
_
Patches currently in -mm which might be from [email protected] are
selftests-mm-fix-memleak-in-migration-benchmark.patch
selftests-mm-factor-out-hmm_buffer_alloc-to-consolidate-buffer-setup.patch
selftests-mm-fix-bug_on-checking-wrong-variable-in-mremap_dontunmap.patch
mm-swap-fix-swap_cluster_lock-config_swap-stub-signature-mismatch.patch
mm-use-a-folio-in-the-softleaf_is_device_private-path.patch
selftests-prctl-fix-non-anonymous-vma-mapping-in-set-anon-vma-name-test.patch