Re: [PATCH v2 1/4] mm: support promotion-only NUMA hinting scans
From: David Hildenbrand (Arm)
Date: Fri Sep 18 2026 - 08:34:09 EST
On 9/17/26 18:14, Gregory Price wrote:
> On Thu, Sep 17, 2026 at 06:03:28PM +0200, Peter Zijlstra wrote:
>> On Thu, Sep 10, 2026 at 08:18:23PM -0400, Gregory Price wrote:
>>
>>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>>> index 8dff37059faf..81359b414947 100644
>>> --- a/kernel/sched/fair.c
>>> +++ b/kernel/sched/fair.c
>>> @@ -4129,8 +4129,10 @@ static void task_numa_work(struct callback_head *work)
>>> unsigned long nr_pte_updates = 0;
>>> long pages, virtpages;
>>> struct vma_iterator vmi;
>>> + unsigned int numab_mode = READ_ONCE(sysctl_numa_balancing_mode);
>>
>> This thing sticks out like a sort thumb, does that want to be on top?
>> Typically reverse xmas is preferred and all that.
>>
>
> oi yeah sorry, should have given this a closer style look.
>
> will fix it up.
>
>>> bool vma_pids_skipped;
>>> bool vma_pids_forced = false;
>>> + bool promo_only;
>>>
>>> WARN_ON_ONCE(p != container_of(work, struct task_struct, numa_work));
>>>
>>
>>> --- a/mm/internal.h
>>> +++ b/mm/internal.h
>>> @@ -1237,11 +1237,12 @@ static inline bool vma_is_single_threaded_private(struct vm_area_struct *vma)
>>>
>>> #ifdef CONFIG_NUMA_BALANCING
>>> bool folio_can_map_prot_numa(struct folio *folio, struct vm_area_struct *vma,
>>> - bool is_private_single_threaded);
>>> + bool is_private_single_threaded, bool promo_only);
>>
>> Two bools rather than updating the existing bool to a flags?
>
> every time i've added a flag field someone screeches at me, so I tend
> to avoid it now - but i can do that's the preference here.
>
> Otherwise, i tend to follow rule of 3 for generalizing.
The is_private_single_threaded only exists to repeatedly call
vma_is_single_threaded_private().
Maybe we don't care about that optimization.
So maybe move the vma_is_single_threaded_private() call into
folio_can_map_prot_numa() and avoid one bool entirely ... and then maybe just
pass the cp_flags?
--
Cheers,
David