[PATCH v2 0/2] mm: introduce pmd|pte_needs_soft_dirty_wp helpers and utilize them

From: Barry Song
Date: Fri Jun 07 2024 - 17:14:27 EST


From: Barry Song <v-songbaohua@xxxxxxxx>

This patchset introduces the pte_need_soft_dirty_wp and pmd_need_soft_dirty_wp
helpers to determine if write protection is required for softdirty tracking.
These helpers enhance code readability and improve the overall appearance.

They are then utilized in gup, mprotect, swap, and other related functions.

-v2:
* rename "need" to "needs" per David;
* separate the change of do_swap_page() per david;

Thanks to David for his original suggestions on this[1].
[1] https://lore.kernel.org/linux-mm/baf84b51-7e8a-4da8-9662-3f5cf14ad6f6@xxxxxxxxxx/

Barry Song (2):
mm: introduce pmd|pte_needs_soft_dirty_wp helpers for softdirty
write-protect
mm: set pte writable while pmd_soft_dirty() is true in do_swap_page()

mm/gup.c | 4 ++--
mm/huge_memory.c | 2 +-
mm/internal.h | 10 ++++++++++
mm/memory.c | 2 +-
mm/mprotect.c | 2 +-
5 files changed, 15 insertions(+), 5 deletions(-)

--
2.34.1