Re: [PATCH V2 2/3] sched/numa: Enhance vma scanning logic

From: Raghavendra K T
Date: Mon Feb 27 2023 - 23:59:57 EST


On 2/4/2023 11:44 PM, Raghavendra K T wrote:
On 2/3/2023 4:45 PM, Peter Zijlstra wrote:
On Wed, Feb 01, 2023 at 01:32:21PM +0530, Raghavendra K T wrote:
[...]>>> diff --git a/mm/memory.c b/mm/memory.c
index 8c8420934d60..2ec3045cb8b3 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -4718,6 +4718,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
      bool was_writable = pte_savedwrite(vmf->orig_pte);
      int flags = 0;
+    vma_set_active_pid_bit(vma);
      /*
       * The "pte" at this point cannot be used safely without
       * validation through pte_unmap_same(). It's of NUMA type but

Urghh... do_*numa_page() is two near identical functions.. is there
really no sane way to de-duplicate at least some of that?


Agree. I will explore and will take that as a separate TODO.


Did spend some time to look at if there is a better way of merging these
two.
code looks similar as you noted, with very subtle changes (pte vs pmd
and difference in unlock).
But I thought only some part of the code can be changed easily, but changing whole code did not look to be worth as of now.
(unless we come up with better idea)

This is the only comment perhaps not addressed rightly I feel :(

Thanks