Re: [PATCH v3 3/7] sched/numa: scan read-only file mappings in tiering mode
From: Gregory Price
Date: Thu Sep 24 2026 - 20:35:11 EST
On Thu, Sep 24, 2026 at 10:53:56PM +0200, David Hildenbrand (Arm) wrote:
> > + placement_scan &= numab_mode & NUMA_BALANCING_NORMAL;
>
> Do we have to update placement_scan at all?
in the following commits this composes:
placement_scan &= numab_mode & NUMA_BALANCING_NORMAL;
if (scan_started)
placement_scan &= vma->numab_state->placement_scan;
else if (tiering)
placement_scan &= placement_due;
But i'll think about this when I update the function name.
>
> Can't we do:
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 8a4687f67d82f..fc8862ee31442 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -4121,6 +4121,7 @@ static void task_numa_work(struct callback_head *work)
> {
> const unsigned int numab_mode = READ_ONCE(sysctl_numa_balancing_mode);
> const bool tiering = numab_mode & NUMA_BALANCING_MEMORY_TIERING;
> + const bool balancing = numab_mode & NUMA_BALANCING_NORMAL;
> unsigned long migrate, next_scan, now = jiffies;
> struct task_struct *p = current;
> struct mm_struct *mm = p->mm;
> @@ -4313,9 +4314,8 @@ static void task_numa_work(struct callback_head *work)
> continue;
> }
>
> - placement_scan &= numab_mode & NUMA_BALANCING_NORMAL;
> cp_flags = MM_CP_PROT_NUMA;
> - if (!placement_scan)
> + if (!placement_scan || !balancing)
> cp_flags |= MM_CP_PROT_NUMA_PROMO_ONLY;
>
> do {
>
> (maybe I messed up my boolean algreba, it's late)
>
> --
> Cheers,
>
> David
>