On 21/07/25 5:14 am, Barry Song wrote:
On Fri, Jul 18, 2025 at 5:03 PM Dev Jain <dev.jain@xxxxxxx> wrote:
Reduce indentation by refactoring the prot_numa case into a new function.Reviewed-by: Barry Song <baohua@xxxxxxxxxx>
No functional change intended.
Signed-off-by: Dev Jain <dev.jain@xxxxxxx>
---[...]
mm/mprotect.c | 101 +++++++++++++++++++++++++++-----------------------
1 file changed, 55 insertions(+), 46 deletions(-)
diff --git a/mm/mprotect.c b/mm/mprotect.c
index 88709c01177b..2a9c73bd0778 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -83,6 +83,59 @@ bool can_change_pte_writable(struct vm_area_struct *vma, unsigned long addr,
return pte_dirty(pte);
}
+static bool prot_numa_skip(struct vm_area_struct *vma, unsigned long addr,
+ pte_t oldpte, pte_t *pte, int target_node)
+{
+ /*Nit: I wonder if this should be moved elsewhere, since this isn't
+ * Skip scanning top tier node if normal numa
+ * balancing is disabled
+ */
+ if (!(sysctl_numa_balancing_mode & NUMA_BALANCING_NORMAL) && toptier)
+ return true;
+
+ if (folio_use_access_time(folio))
+ folio_xchg_access_time(folio, jiffies_to_msecs(jiffies));
actually about 'skipping', even though the function is named
`prot_numa_skip()`.
Agreed, thanks. We can use prot_numa_skip() only to return true
or false, and if returned false, we can call folio_xchg_access_time.
I will wait for 2-3 days for any more comments and respin.
+ return false;Thanks
+}
+
Barry