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.