[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250121043355.177611-1-bharata@amd.com>
Date: Tue, 21 Jan 2025 10:03:55 +0530
From: Bharata B Rao <bharata@....com>
To: <gourry@...rry.net>
CC: <abhishekd@...a.com>, <akpm@...ux-foundation.org>, <david@...hat.com>,
<donettom@...ux.ibm.com>, <feng.tang@...el.com>, <hannes@...xchg.org>,
<kbusch@...a.com>, <kernel-team@...a.com>, <linux-doc@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-mm@...ck.org>, <nehagholkar@...a.com>,
<nphamcs@...il.com>, <ying.huang@...ux.alibaba.com>
Subject: Re: [PATCH v3 2/6] memory: move conditionally defined enums use inside ifdef tags
> NUMA_HINT_FAULTS and NUMA_HINT_FAULTS_LOCAL are only defined if
> CONFIG_NUMA_BALANCING is defined, but are used outside the tags in
> numa_migrate_check(). Fix this.
>
> TNF_SHARED is only used if CONFIG_NUMA_BALANCING is enabled, so
> moving this line inside the ifdef is also safe - despite use of TNF_*
> elsewhere in the function. TNF_* are not conditionally defined.
>
> Signed-off-by: Gregory Price <gourry@...rry.net>
> ---
> mm/memory.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/memory.c b/mm/memory.c
> index 9cc93c2f79f3..8d254e97840d 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -5571,14 +5571,14 @@ int numa_migrate_check(struct folio *folio, struct vm_fault *vmf,
> /* Record the current PID acceesing VMA */
> vma_set_access_pid_bit(vma);
>
> - count_vm_numa_event(NUMA_HINT_FAULTS);
> #ifdef CONFIG_NUMA_BALANCING
> + count_vm_numa_event(NUMA_HINT_FAULTS);
> count_memcg_folio_events(folio, NUMA_HINT_FAULTS, 1);
> -#endif
> if (folio_nid(folio) == numa_node_id()) {
> count_vm_numa_event(NUMA_HINT_FAULTS_LOCAL);
> *flags |= TNF_FAULT_LOCAL;
> }
> +#endif
I don't think moving count_vm_numa_event() to within
CONFIG_NUMA_BALANCING is necessary as it is defined separately as NOP
for !CONFIG_NUMA_BALANCING.
In fact numa_migrate_check() should be within CONFIG_NUMA_BALANCING as
it should ideally be called only if NUMA balancing is enabled. The same
could be said for the callers of numa_migrate_check() which are
do_numa_page() and do_huge_pmd_numa_page().
Regards,
Bharata.
Powered by blists - more mailing lists