On Tue, Sep 14, 2021 at 6:14 AM Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxx> wrote: > > Platforms can have non-contiguous NUMA nodes like below > > #numactl -H > available: 2 nodes (0,8) > ..... > node distances: > node 0 8 > 0: 10 40 > 8: 40 10 > > #numactl -H > available: 1 nodes (1) > .... > node distances: > node 1 > 1: 10 > > Hence update the test to not assume the presence of Node 0 and 1 > and also use numa_num_configured_nodes() instead of numa_max_node > for finding whether to skip the test. > > Cc: Zhansaya Bagdauletkyzy <zhansayabagdaulet@xxxxxxxxx> > Cc: Pavel Tatashin <pasha.tatashin@xxxxxxxxxx> > Cc: Tyler Hicks <tyhicks@xxxxxxxxxxxxxxxxxxx> > Cc: Hugh Dickins <hughd@xxxxxxxxxx> > Cc: Shuah Khan <shuah@xxxxxxxxxx> > Fixes: 82e717ad3501 ("selftests: vm: add KSM merging across nodes test") > Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxx> > --- > Changes from v2: > * Add Fixes: line > > Changes from v1: > * Updates based on review feedback. > > tools/testing/selftests/vm/ksm_tests.c | 29 +++++++++++++++++++++++--- > 1 file changed, 26 insertions(+), 3 deletions(-) > > diff --git a/tools/testing/selftests/vm/ksm_tests.c b/tools/testing/selftests/vm/ksm_tests.c > index b61dcdb44c5b..73132d852513 100644 > --- a/tools/testing/selftests/vm/ksm_tests.c > +++ b/tools/testing/selftests/vm/ksm_tests.c > @@ -354,12 +354,34 @@ static int check_ksm_zero_page_merge(int mapping, int prot, long page_count, int > return KSFT_FAIL; > } > > +static int get_next_mem_node(int node) > +{ > + > + long node_size; > + int mem_node; Please initialize mem_node, otherwise if numa_max_node() returns 0, mem_node will be returned from this function uninitialized. With this fixed, looks good: Reviewed-by: Pasha Tatashin <pasha.tatashin@xxxxxxxxxx>