All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: use softleaf_migration_mkreadable() in change_protection()
@ 2026-12-02  4:59 Chris Down
  2026-12-03  3:14 ` Muchun Song
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Chris Down @ 2026-12-02  4:59 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Muchun Song, Oscar Salvador, David Hildenbrand, Zi Yan,
	Baolin Wang, Liam R. Howlett, Nico Pache, Ryan Roberts, Dev Jain,
	Barry Song, Lance Yang, Usama Arif, Kiryl Shutsemau,
	Lorenzo Stoakes, Suren Baghdasaryan, Vlastimil Babka,
	Shakeel Butt, Pedro Falcato, Jann Horn, linux-mm, linux-kernel,
	Tal Zussman

change_protection() downgrades a writable migration entry to a readable
one in change_softleaf_pte(), change_non_present_huge_pmd() and
hugetlb_change_protection(). Each of them open codes the same choice:
the new entry is readable exclusive if the folio is anonymous, since a
writable anon migration entry implies AnonExclusive, and plain readable
otherwise.

PAGEMAP_SCAN's write-protect path needed the same downgrade, so
softleaf_migration_mkreadable() was added to leafops.h for it. Let's use
it in change_protection() too. Each site still handles the soft-dirty
and uffd bits itself as before. hugetlb_change_protection() only looked
up the folio for this choice, so its local goes away.

The other places that choose between readable exclusive and readable
migration entries, such as try_to_migrate_one() and
__split_huge_pmd_locked(), carry over the exclusive state of the page or
of the old entry rather than downgrade a writable one, so they are left
alone.

No functional change intended.

Suggested-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Signed-off-by: Chris Down <chris@chrisdown.name>
---
 mm/huge_memory.c | 7 +------
 mm/hugetlb.c     | 8 +-------
 mm/mprotect.c    | 7 +------
 3 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 4fc888ddfb69..ce028838bdba 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2704,16 +2704,11 @@ static void change_non_present_huge_pmd(struct mm_struct *mm,
 
 	VM_WARN_ON(!pmd_is_valid_softleaf(*pmd));
 	if (softleaf_is_migration_write(entry)) {
-		const struct folio *folio = softleaf_to_folio(entry);
-
 		/*
 		 * A protection check is difficult so
 		 * just be safe and disable write
 		 */
-		if (folio_test_anon(folio))
-			entry = make_readable_exclusive_migration_entry(swp_offset(entry));
-		else
-			entry = make_readable_migration_entry(swp_offset(entry));
+		entry = softleaf_migration_mkreadable(entry);
 		newpmd = softleaf_to_pmd(entry);
 		if (pmd_swp_soft_dirty(*pmd))
 			newpmd = pmd_swp_mksoft_dirty(newpmd);
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 367c93f851d5..f1e0ed41af09 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -6831,16 +6831,10 @@ long hugetlb_change_protection(struct vm_area_struct *vma,
 		if (unlikely(softleaf_is_hwpoison(entry))) {
 			/* Nothing to do. */
 		} else if (unlikely(softleaf_is_migration(entry))) {
-			struct folio *folio = softleaf_to_folio(entry);
 			pte_t newpte = pte;
 
 			if (softleaf_is_migration_write(entry)) {
-				if (folio_test_anon(folio))
-					entry = make_readable_exclusive_migration_entry(
-								swp_offset(entry));
-				else
-					entry = make_readable_migration_entry(
-								swp_offset(entry));
+				entry = softleaf_migration_mkreadable(entry);
 				newpte = swp_entry_to_pte(entry);
 				pages++;
 			}
diff --git a/mm/mprotect.c b/mm/mprotect.c
index ef4e7188e24d..e1c4f8fca4e8 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -221,16 +221,11 @@ static long change_softleaf_pte(struct vm_area_struct *vma,
 	pte_t newpte;
 
 	if (softleaf_is_migration_write(entry)) {
-		const struct folio *folio = softleaf_to_folio(entry);
-
 		/*
 		 * A protection check is difficult so
 		 * just be safe and disable write
 		 */
-		if (folio_test_anon(folio))
-			entry = make_readable_exclusive_migration_entry(swp_offset(entry));
-		else
-			entry = make_readable_migration_entry(swp_offset(entry));
+		entry = softleaf_migration_mkreadable(entry);
 		newpte = swp_entry_to_pte(entry);
 		if (pte_swp_soft_dirty(oldpte))
 			newpte = pte_swp_mksoft_dirty(newpte);

base-commit: 4bffe3da0065e60f45a0b96f7460e5e7f7d2b63a
-- 
2.56.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] mm: use softleaf_migration_mkreadable() in change_protection()
  2026-12-02  4:59 [PATCH] mm: use softleaf_migration_mkreadable() in change_protection() Chris Down
@ 2026-12-03  3:14 ` Muchun Song
  2026-12-03  7:57 ` David Hildenbrand (Arm)
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Muchun Song @ 2026-12-03  3:14 UTC (permalink / raw)
  To: Chris Down
  Cc: Muchun Song, Andrew Morton, Oscar Salvador, David Hildenbrand,
	Zi Yan, Baolin Wang, Liam R. Howlett, Nico Pache, Ryan Roberts,
	Dev Jain, Barry Song, Lance Yang, Usama Arif, Kiryl Shutsemau,
	Lorenzo Stoakes, Suren Baghdasaryan, Vlastimil Babka,
	Shakeel Butt, Pedro Falcato, Jann Horn, linux-mm, linux-kernel,
	Tal Zussman



> On Dec 2, 2026, at 12:59, Chris Down <chris@chrisdown.name> wrote:
> 
> change_protection() downgrades a writable migration entry to a readable
> one in change_softleaf_pte(), change_non_present_huge_pmd() and
> hugetlb_change_protection(). Each of them open codes the same choice:
> the new entry is readable exclusive if the folio is anonymous, since a
> writable anon migration entry implies AnonExclusive, and plain readable
> otherwise.
> 
> PAGEMAP_SCAN's write-protect path needed the same downgrade, so
> softleaf_migration_mkreadable() was added to leafops.h for it. Let's use
> it in change_protection() too. Each site still handles the soft-dirty
> and uffd bits itself as before. hugetlb_change_protection() only looked
> up the folio for this choice, so its local goes away.
> 
> The other places that choose between readable exclusive and readable
> migration entries, such as try_to_migrate_one() and
> __split_huge_pmd_locked(), carry over the exclusive state of the page or
> of the old entry rather than downgrade a writable one, so they are left
> alone.
> 
> No functional change intended.
> 
> Suggested-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> Signed-off-by: Chris Down <chris@chrisdown.name>

Nive cleanup.

Acked-by: Muchun Song (ByteDance) <muchun.song@linux.dev>

THanks.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mm: use softleaf_migration_mkreadable() in change_protection()
  2026-12-02  4:59 [PATCH] mm: use softleaf_migration_mkreadable() in change_protection() Chris Down
  2026-12-03  3:14 ` Muchun Song
@ 2026-12-03  7:57 ` David Hildenbrand (Arm)
  2026-12-03  8:31 ` David Hildenbrand (Arm)
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: David Hildenbrand (Arm) @ 2026-12-03  7:57 UTC (permalink / raw)
  To: Chris Down, Andrew Morton
  Cc: Muchun Song, Oscar Salvador, Zi Yan, Baolin Wang, Liam R. Howlett,
	Nico Pache, Ryan Roberts, Dev Jain, Barry Song, Lance Yang,
	Usama Arif, Kiryl Shutsemau, Lorenzo Stoakes, Suren Baghdasaryan,
	Vlastimil Babka, Shakeel Butt, Pedro Falcato, Jann Horn, linux-mm,
	linux-kernel, Tal Zussman

On 12/2/26 05:59, Chris Down wrote:
> change_protection() downgrades a writable migration entry to a readable
> one in change_softleaf_pte(), change_non_present_huge_pmd() and
> hugetlb_change_protection(). Each of them open codes the same choice:
> the new entry is readable exclusive if the folio is anonymous, since a
> writable anon migration entry implies AnonExclusive, and plain readable
> otherwise.
> 
> PAGEMAP_SCAN's write-protect path needed the same downgrade, so
> softleaf_migration_mkreadable() was added to leafops.h for it. Let's use
> it in change_protection() too. Each site still handles the soft-dirty
> and uffd bits itself as before. hugetlb_change_protection() only looked
> up the folio for this choice, so its local goes away.
> 
> The other places that choose between readable exclusive and readable
> migration entries, such as try_to_migrate_one() and
> __split_huge_pmd_locked(), carry over the exclusive state of the page or
> of the old entry rather than downgrade a writable one, so they are left
> alone.
> 
> No functional change intended.
> 
> Suggested-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> Signed-off-by: Chris Down <chris@chrisdown.name>
> ---
>  mm/huge_memory.c | 7 +------
>  mm/hugetlb.c     | 8 +-------
>  mm/mprotect.c    | 7 +------
>  3 files changed, 3 insertions(+), 19 deletions(-)
> 
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 4fc888ddfb69..ce028838bdba 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -2704,16 +2704,11 @@ static void change_non_present_huge_pmd(struct mm_struct *mm,
>  
>  	VM_WARN_ON(!pmd_is_valid_softleaf(*pmd));
>  	if (softleaf_is_migration_write(entry)) {
> -		const struct folio *folio = softleaf_to_folio(entry);
> -
>  		/*
>  		 * A protection check is difficult so
>  		 * just be safe and disable write
>  		 */
> -		if (folio_test_anon(folio))
> -			entry = make_readable_exclusive_migration_entry(swp_offset(entry));
> -		else
> -			entry = make_readable_migration_entry(swp_offset(entry));
> +		entry = softleaf_migration_mkreadable(entry);

softleaf_migration_mkreadable() looks up the folio again from the pfn ... which
isn't particularly nice. We avoid looking up things again.

But that will all change at some point when we just use the swp_exclusive pte
bit instead.

Acked-by: David Hildenbrand (Arm) <david@kernel.org>

-- 
Cheers,

David


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mm: use softleaf_migration_mkreadable() in change_protection()
  2026-12-02  4:59 [PATCH] mm: use softleaf_migration_mkreadable() in change_protection() Chris Down
  2026-12-03  3:14 ` Muchun Song
  2026-12-03  7:57 ` David Hildenbrand (Arm)
@ 2026-12-03  8:31 ` David Hildenbrand (Arm)
  2026-12-03 20:12 ` + mm-use-softleaf_migration_mkreadable-in-change_protection.patch added to mm-new branch Andrew Morton
  2026-12-04 16:37 ` [PATCH] mm: use softleaf_migration_mkreadable() in change_protection() Zi Yan
  4 siblings, 0 replies; 6+ messages in thread
From: David Hildenbrand (Arm) @ 2026-12-03  8:31 UTC (permalink / raw)
  To: Chris Down, Andrew Morton
  Cc: Muchun Song, Oscar Salvador, Zi Yan, Baolin Wang, Liam R. Howlett,
	Nico Pache, Ryan Roberts, Dev Jain, Barry Song, Lance Yang,
	Usama Arif, Kiryl Shutsemau, Lorenzo Stoakes, Suren Baghdasaryan,
	Vlastimil Babka, Shakeel Butt, Pedro Falcato, Jann Horn, linux-mm,
	linux-kernel, Tal Zussman

On 12/2/26 05:59, Chris Down wrote:
> change_protection() downgrades a writable migration entry to a readable
> one in change_softleaf_pte(), change_non_present_huge_pmd() and
> hugetlb_change_protection(). Each of them open codes the same choice:
> the new entry is readable exclusive if the folio is anonymous, since a
> writable anon migration entry implies AnonExclusive, and plain readable
> otherwise.
> 
> PAGEMAP_SCAN's write-protect path needed the same downgrade, so
> softleaf_migration_mkreadable() was added to leafops.h for it. Let's use
> it in change_protection() too. Each site still handles the soft-dirty
> and uffd bits itself as before. hugetlb_change_protection() only looked
> up the folio for this choice, so its local goes away.
> 
> The other places that choose between readable exclusive and readable
> migration entries, such as try_to_migrate_one() and
> __split_huge_pmd_locked(), carry over the exclusive state of the page or
> of the old entry rather than downgrade a writable one, so they are left
> alone.
> 
> No functional change intended.
> 
> Suggested-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> Signed-off-by: Chris Down <chris@chrisdown.name>
> ---
>  mm/huge_memory.c | 7 +------
>  mm/hugetlb.c     | 8 +-------
>  mm/mprotect.c    | 7 +------
>  3 files changed, 3 insertions(+), 19 deletions(-)
> 
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 4fc888ddfb69..ce028838bdba 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -2704,16 +2704,11 @@ static void change_non_present_huge_pmd(struct mm_struct *mm,
>  
>  	VM_WARN_ON(!pmd_is_valid_softleaf(*pmd));
>  	if (softleaf_is_migration_write(entry)) {
> -		const struct folio *folio = softleaf_to_folio(entry);
> -
>  		/*
>  		 * A protection check is difficult so
>  		 * just be safe and disable write
>  		 */
> -		if (folio_test_anon(folio))
> -			entry = make_readable_exclusive_migration_entry(swp_offset(entry));
> -		else
> -			entry = make_readable_migration_entry(swp_offset(entry));
> +		entry = softleaf_migration_mkreadable(entry);

softleaf_migration_mkreadable is not upstream yet, so this change best goes
through Andrew's tree.

-- 
Cheers,

David

^ permalink raw reply	[flat|nested] 6+ messages in thread

* + mm-use-softleaf_migration_mkreadable-in-change_protection.patch added to mm-new branch
  2026-12-02  4:59 [PATCH] mm: use softleaf_migration_mkreadable() in change_protection() Chris Down
                   ` (2 preceding siblings ...)
  2026-12-03  8:31 ` David Hildenbrand (Arm)
@ 2026-12-03 20:12 ` Andrew Morton
  2026-12-04 16:37 ` [PATCH] mm: use softleaf_migration_mkreadable() in change_protection() Zi Yan
  4 siblings, 0 replies; 6+ messages in thread
From: Andrew Morton @ 2026-12-03 20:12 UTC (permalink / raw)
  To: mm-commits, ziy, vbabka, usama.arif, tz2294, surenb, shakeel.butt,
	ryan.roberts, pfalcato, osalvador, nico.pache, muchun.song, ljs,
	liam, lance.yang, kas, jannh, dev.jain, david, baolin.wang,
	baohua, chris, akpm


The patch titled
     Subject: mm: use softleaf_migration_mkreadable() in change_protection()
has been added to the -mm mm-new branch.  Its filename is
     mm-use-softleaf_migration_mkreadable-in-change_protection.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-use-softleaf_migration_mkreadable-in-change_protection.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: Chris Down <chris@chrisdown.name>
Subject: mm: use softleaf_migration_mkreadable() in change_protection()
Date: Tue, 01 Dec 2026 20:59:09 -0800

change_protection() downgrades a writable migration entry to a readable
one in change_softleaf_pte(), change_non_present_huge_pmd() and
hugetlb_change_protection().  Each of them open codes the same choice: the
new entry is readable exclusive if the folio is anonymous, since a
writable anon migration entry implies AnonExclusive, and plain readable
otherwise.

PAGEMAP_SCAN's write-protect path needed the same downgrade, so
softleaf_migration_mkreadable() was added to leafops.h for it.  Let's use
it in change_protection() too.  Each site still handles the soft-dirty and
uffd bits itself as before.  hugetlb_change_protection() only looked up
the folio for this choice, so its local goes away.

The other places that choose between readable exclusive and readable
migration entries, such as try_to_migrate_one() and
__split_huge_pmd_locked(), carry over the exclusive state of the page or
of the old entry rather than downgrade a writable one, so they are left
alone.

No functional change intended.

Link: https://patch.msgid.link/1b920241d08ed3c39c2cd19a5507529bb3af95a2.1796187429.git.chris@chrisdown.name
Signed-off-by: Chris Down <chris@chrisdown.name>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Suggested-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Acked-by: Muchun Song (ByteDance) <muchun.song@linux.dev>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Nico Pache <nico.pache@linux.dev>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Dev Jain <dev.jain@arm.com>
Cc: Barry Song <baohua@kernel.org>
Cc: Lance Yang <lance.yang@linux.dev>
Cc: Usama Arif <usama.arif@linux.dev>
Cc: Kiryl Shutsemau <kas@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Pedro Falcato <pfalcato@suse.de>
Cc: Jann Horn <jannh@google.com>
Cc: Tal Zussman <tz2294@columbia.edu>

 mm/huge_memory.c |    7 +------
 mm/hugetlb.c     |    8 +-------
 mm/mprotect.c    |    7 +------
 3 files changed, 3 insertions(+), 19 deletions(-)

--- a/mm/huge_memory.c~mm-use-softleaf_migration_mkreadable-in-change_protection
+++ a/mm/huge_memory.c
@@ -2703,16 +2703,11 @@ static void change_non_present_huge_pmd(
 
 	VM_WARN_ON(!pmd_is_valid_softleaf(*pmd));
 	if (softleaf_is_migration_write(entry)) {
-		const struct folio *folio = softleaf_to_folio(entry);
-
 		/*
 		 * A protection check is difficult so
 		 * just be safe and disable write
 		 */
-		if (folio_test_anon(folio))
-			entry = make_readable_exclusive_migration_entry(swp_offset(entry));
-		else
-			entry = make_readable_migration_entry(swp_offset(entry));
+		entry = softleaf_migration_mkreadable(entry);
 		newpmd = softleaf_to_pmd(entry);
 		if (pmd_swp_soft_dirty(*pmd))
 			newpmd = pmd_swp_mksoft_dirty(newpmd);
--- a/mm/hugetlb.c~mm-use-softleaf_migration_mkreadable-in-change_protection
+++ a/mm/hugetlb.c
@@ -6919,16 +6919,10 @@ long hugetlb_change_protection(struct vm
 		if (unlikely(softleaf_is_hwpoison(entry))) {
 			/* Nothing to do. */
 		} else if (unlikely(softleaf_is_migration(entry))) {
-			struct folio *folio = softleaf_to_folio(entry);
 			pte_t newpte = pte;
 
 			if (softleaf_is_migration_write(entry)) {
-				if (folio_test_anon(folio))
-					entry = make_readable_exclusive_migration_entry(
-								swp_offset(entry));
-				else
-					entry = make_readable_migration_entry(
-								swp_offset(entry));
+				entry = softleaf_migration_mkreadable(entry);
 				newpte = swp_entry_to_pte(entry);
 				pages++;
 			}
--- a/mm/mprotect.c~mm-use-softleaf_migration_mkreadable-in-change_protection
+++ a/mm/mprotect.c
@@ -221,16 +221,11 @@ static long change_softleaf_pte(struct v
 	pte_t newpte;
 
 	if (softleaf_is_migration_write(entry)) {
-		const struct folio *folio = softleaf_to_folio(entry);
-
 		/*
 		 * A protection check is difficult so
 		 * just be safe and disable write
 		 */
-		if (folio_test_anon(folio))
-			entry = make_readable_exclusive_migration_entry(swp_offset(entry));
-		else
-			entry = make_readable_migration_entry(swp_offset(entry));
+		entry = softleaf_migration_mkreadable(entry);
 		newpte = swp_entry_to_pte(entry);
 		if (pte_swp_soft_dirty(oldpte))
 			newpte = pte_swp_mksoft_dirty(newpte);
_

Patches currently in -mm which might be from chris@chrisdown.name are

selftests-mm-add-uffdio_move-huge-zeropage-pmd-regression-test.patch
mm-use-softleaf_migration_mkreadable-in-change_protection.patch


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] mm: use softleaf_migration_mkreadable() in change_protection()
  2026-12-02  4:59 [PATCH] mm: use softleaf_migration_mkreadable() in change_protection() Chris Down
                   ` (3 preceding siblings ...)
  2026-12-03 20:12 ` + mm-use-softleaf_migration_mkreadable-in-change_protection.patch added to mm-new branch Andrew Morton
@ 2026-12-04 16:37 ` Zi Yan
  4 siblings, 0 replies; 6+ messages in thread
From: Zi Yan @ 2026-12-04 16:37 UTC (permalink / raw)
  To: Chris Down
  Cc: Andrew Morton, Muchun Song, Oscar Salvador, David Hildenbrand,
	Baolin Wang, Liam R. Howlett, Nico Pache, Ryan Roberts, Dev Jain,
	Barry Song, Lance Yang, Usama Arif, Kiryl Shutsemau,
	Lorenzo Stoakes, Suren Baghdasaryan, Vlastimil Babka,
	Shakeel Butt, Pedro Falcato, Jann Horn, linux-mm, linux-kernel,
	Tal Zussman

On 1 Dec 2026, at 23:59, Chris Down wrote:

> change_protection() downgrades a writable migration entry to a readable
> one in change_softleaf_pte(), change_non_present_huge_pmd() and
> hugetlb_change_protection(). Each of them open codes the same choice:
> the new entry is readable exclusive if the folio is anonymous, since a
> writable anon migration entry implies AnonExclusive, and plain readable
> otherwise.
>
> PAGEMAP_SCAN's write-protect path needed the same downgrade, so
> softleaf_migration_mkreadable() was added to leafops.h for it. Let's use
> it in change_protection() too. Each site still handles the soft-dirty
> and uffd bits itself as before. hugetlb_change_protection() only looked
> up the folio for this choice, so its local goes away.
>
> The other places that choose between readable exclusive and readable
> migration entries, such as try_to_migrate_one() and
> __split_huge_pmd_locked(), carry over the exclusive state of the page or
> of the old entry rather than downgrade a writable one, so they are left
> alone.
>
> No functional change intended.
>
> Suggested-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>
> Signed-off-by: Chris Down <chris@chrisdown.name>
> ---
>  mm/huge_memory.c | 7 +------
>  mm/hugetlb.c     | 8 +-------
>  mm/mprotect.c    | 7 +------
>  3 files changed, 3 insertions(+), 19 deletions(-)
>
LGTM.

Reviewed-by: Zi Yan <ziy@nvidia.com>

Best Regards,
Yan, Zi


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-12-04 16:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02  4:59 [PATCH] mm: use softleaf_migration_mkreadable() in change_protection() Chris Down
2026-12-03  3:14 ` Muchun Song
2026-12-03  7:57 ` David Hildenbrand (Arm)
2026-12-03  8:31 ` David Hildenbrand (Arm)
2026-12-03 20:12 ` + mm-use-softleaf_migration_mkreadable-in-change_protection.patch added to mm-new branch Andrew Morton
2026-12-04 16:37 ` [PATCH] mm: use softleaf_migration_mkreadable() in change_protection() Zi Yan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.