[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8ccedc5a-168d-406d-b363-6fce62f0100a@amd.com>
Date: Thu, 23 Jan 2025 08:37:29 +0530
From: Bharata B Rao <bharata@....com>
To: Gregory Price <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
On 22-Jan-25 11:31 PM, Gregory Price wrote:
> On Tue, Jan 21, 2025 at 10:03:55AM +0530, Bharata B Rao wrote:
>> 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.
>>
>
> NUMA_HINT_FAULTS and NUMA_HINT_FAULTS_LOCAL are only defined if
> CONFIG_NUMA_BALANCING
>
> include/linux/vm_event_item.h
>
> #ifdef CONFIG_NUMA_BALANCING
> NUMA_PTE_UPDATES,
> NUMA_HUGE_PTE_UPDATES,
> NUMA_HINT_FAULTS,
> NUMA_HINT_FAULTS_LOCAL,
> NUMA_PAGE_MIGRATE,
> #endif
What I meant is
include/linux/vmstat.h has a definition for count_vm_numa_event() for
!CONFIG_NUMA_BALANCING case like below:
#ifdef CONFIG_NUMA_BALANCING
#define count_vm_numa_event(x) count_vm_event(x)
#define count_vm_numa_events(x, y) count_vm_events(x, y)
#else
#define count_vm_numa_event(x) do {} while (0)
#define count_vm_numa_events(x, y) do { (void)(y); } while (0)
#endif /* CONFIG_NUMA_BALANCING */
and hence moving count_vm_numa_events(NUMA_HINT_FAULTS) to within
CONFIG_NUMA_BALANCING section in numa_migrate_check() isn't necessary.
The current code already compiles fine when CONFIG_NUMA_BALANCING is
turned off.
>
>> 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().
>>
>
> Really what i'm reading is that these functions are in the wrong file,
> since ifdef spaghetti in *.c files is not encouraged. These functions
> should be moved somewhere else and given stubs if the build option is
> off.
Yes !CONFIG_NUMA_BALANCING stubs for numa_migrate_check(),
do_numa_page() and do_huge_pmd_numa_page() would be good.
Regards,
Bharata.
Powered by blists - more mailing lists