From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-174.mta1.migadu.com (out-174.mta1.migadu.com [95.215.58.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02469416CF5 for ; Wed, 8 Jul 2026 13:55:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783518937; cv=none; b=LmMJJc0OIUJwpAGi4LE3d/Gc3B8d0UK5suZn4tsPcLfAhh5z0XX6oYeuf7L1fOSEV4MK0zxwfADF7v5yU6zgGW0l5w/wyTviq2eT1QPGi4r9W1Cd/7I4ZjiK5LVc1vgqeorlfNsJTCTG9n2JxT+oETdmNrQPWPGwqw/Ngc+gPBc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783518937; c=relaxed/simple; bh=SQGAw42FXt4XG+V4Ly8vHpJ7Sw04TZO294Eo2BUvoQM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XakejsvS6UAhUdYKLdPoSw8jLlep+Y1pzhOFI7ZbTbxfosHeDdxAuboI+ud0M8af4h2AqnSsrN7wKPuAHfDuV3trR3cAzbLg+x3cTJnLBdJnsGky3PIuQo6iMew5UyDdmLqiRrLv4HV07vx1AE50gQ9dcHSAIDhfu0Y2iz4H7U4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=ApkfZAPe; arc=none smtp.client-ip=95.215.58.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="ApkfZAPe" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1783518924; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DumeYOm4RAsOVh0uQBPFbd4lfQ35Js58LdeDgME4iC8=; b=ApkfZAPexPaSLNtsfl42DBx1qyChc5EO2KpX8eeuck2SebANu8tOXOMCQ1T+/zOIgmk5bY 4ee5xmFvzYgajiV3YeMtkSbdFKoo1DTlJed8IyOX2toProdSQ1KS5WwncTjvJLWvf3O0wz lP4gXygReDf/aARZ4m/KTneai1EYZ3A= From: Usama Arif To: Sayali Patil Cc: Usama Arif , Andrew Morton , Shuah Khan , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Ritesh Harjani , David Hildenbrand , Zi Yan , Michal Hocko , Oscar Salvador , Lorenzo Stoakes , Dev Jain , Liam.Howlett@oracle.com, linuxppc-dev@lists.ozlabs.org, Miaohe Lin , Venkat Rao Bagalkote 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 Message-ID: <20260708135503.180169-1-usama.arif@linux.dev> In-Reply-To: <78a3b0e3fb94004c0710872c5bab6f7381b7d63c.1783446924.git.sayalip@linux.ibm.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On Wed, 8 Jul 2026 12:29:06 +0530 Sayali Patil 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) > Signed-off-by: David Hildenbrand (Arm) > Signed-off-by: Sayali Patil > --- > tools/testing/selftests/mm/ksm_tests.c | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) > Acked-by: Usama Arif