From: Usama Arif <usama.arif@linux.dev>
To: Sayali Patil <sayalip@linux.ibm.com>
Cc: Usama Arif <usama.arif@linux.dev>,
Andrew Morton <akpm@linux-foundation.org>,
Shuah Khan <shuah@kernel.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org,
Ritesh Harjani <ritesh.list@gmail.com>,
David Hildenbrand <david@kernel.org>, Zi Yan <ziy@nvidia.com>,
Michal Hocko <mhocko@kernel.org>,
Oscar Salvador <osalvador@suse.de>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
Dev Jain <dev.jain@arm.com>,
Liam.Howlett@oracle.com, linuxppc-dev@lists.ozlabs.org,
Miaohe Lin <linmiaohe@huawei.com>,
Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Subject: Re: [PATCH v3 2/3] selftests/mm: fix ksm NUMA merge test for systems with memoryless NUMA nodes
Date: Wed, 8 Jul 2026 06:55:02 -0700 [thread overview]
Message-ID: <20260708135503.180169-1-usama.arif@linux.dev> (raw)
In-Reply-To: <78a3b0e3fb94004c0710872c5bab6f7381b7d63c.1783446924.git.sayalip@linux.ibm.com>
On Wed, 8 Jul 2026 12:29:06 +0530 Sayali Patil <sayalip@linux.ibm.com> wrote:
> The KSM NUMA merge test allocates identical pages on different NUMA
> nodes and verifies KSM behavior with merge_across_nodes enabled and
> disabled.
>
> On systems with memoryless NUMA nodes, for example:
> #numactl -H
> available: 2 nodes (0,4)
> .....
> node 0 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
> node 0 size: 14825 MB
> node 0 free: 1382 MB
> node 4 cpus:
> node 4 size: 0 MB
> node 4 free: 0 MB
>
> the test may attempt to allocate memory on a node without memory,
> causing numa_alloc_onnode() to fail and resulting in a spurious test
> failure.
>
> The test currently checks numa_num_configured_nodes() to determine
> whether sufficient NUMA nodes are available. However, configured nodes
> do not necessarily have memory.
>
> Reuse the existing get_first_mem_node() and get_next_mem_node()
> helpers to locate NUMA nodes that actually contain memory, and skip
> the test when fewer than two such nodes are available.
>
> Before patch:
> ---------------------------
> running ./ksm_tests -N -m 1
> ---------------------------
> mbind: Invalid argument
> ok 1 KSM NUMA merging
> Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
> [PASS]
> ok 1 ksm_tests -N -m 1
> ---------------------------
> running ./ksm_tests -N -m 0
> ---------------------------
> mbind: Invalid argument
> not ok 1 KSM NUMA merging
> Totals: pass:0 fail:1 xfail:0 xpass:0 skip:0 error:0
> [FAIL]
> not ok 2 ksm_tests -N -m 0 # exit=1
>
> After patch:
> ---------------------------
> running ./ksm_tests -N -m 1
> ---------------------------
> At least 2 NUMA nodes with memory must be available
> ok 1
> SKIP KSM NUMA merging
> Totals: pass:0 fail:0 xfail:0 xpass:0 skip:1 error:0
> [PASS]
> ok 1 ksm_tests -N -m 1
> ---------------------------
> running ./ksm_tests -N -m 0
> ---------------------------
> At least 2 NUMA nodes with memory must be available
> ok 1
> SKIP KSM NUMA merging
> Totals: pass:0 fail:0 xfail:0 xpass:0 skip:1 error:0
> [PASS]
> ok 2 ksm_tests -N -m 0
>
> Fixes: e3820ab252dd ("selftest/vm: fix ksm selftest to run with different NUMA topologies")
> Co-developed-by: David Hildenbrand (Arm) <david@kernel.org>
> Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
> Signed-off-by: Sayali Patil <sayalip@linux.ibm.com>
> ---
> tools/testing/selftests/mm/ksm_tests.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
Acked-by: Usama Arif <usama.arif@linux.dev>
next prev parent reply other threads:[~2026-07-08 13:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-08 6:59 [PATCH v3 0/3] selftests/mm: avoid false failures in hugetlb and KSM tests Sayali Patil
2026-07-08 6:59 ` [PATCH v3 1/3] selftests/mm: handle EINVAL when configuring gigantic hugepages Sayali Patil
2026-07-08 7:38 ` David Hildenbrand (Arm)
2026-07-08 13:48 ` Usama Arif
2026-07-08 6:59 ` [PATCH v3 2/3] selftests/mm: fix ksm NUMA merge test for systems with memoryless NUMA nodes Sayali Patil
2026-07-08 13:55 ` Usama Arif [this message]
2026-07-08 6:59 ` [PATCH v3 3/3] selftests/mm: fix ternary operator precedence in ksm_tests Sayali Patil
2026-07-10 1:53 ` [PATCH v3 0/3] selftests/mm: avoid false failures in hugetlb and KSM tests Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260708135503.180169-1-usama.arif@linux.dev \
--to=usama.arif@linux.dev \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=dev.jain@arm.com \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@kernel.org \
--cc=osalvador@suse.de \
--cc=ritesh.list@gmail.com \
--cc=sayalip@linux.ibm.com \
--cc=shuah@kernel.org \
--cc=venkat88@linux.ibm.com \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox