From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 B872D21CA03 for ; Thu, 25 Jun 2026 21:02:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782421341; cv=none; b=W2rwwW3MhQDXcxbUmimK3m4ohxd4v0Wc6Ngqrea0C9zS0h3Aiuj2IZQL+QXWme4te7yP3dj7oCbx0v0Ck/Z7wBWBpRjnojpWoh0ZAZWYnOPMD31wK8RMgXFKOb01bbIuvlM4gEGdbkyR1WdUnXcXCA6K+021hM6Ye6Yuon1/bDA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782421341; c=relaxed/simple; bh=slYGKsvDnZ7jZTnlMHZ0gDv3bdXFVB1tlDw5+4pfr40=; h=Date:To:From:Subject:Message-Id; b=Ec+X9ivDfF8CNXEwl54+OdlHgZP29Klp3tGG6KKiZggAoFq5rAwZk5J1wcGhFUsINGMbDIvdbVXAOkOix0D3gLSxSK59bUDzdZzMhbsZi5NIZttgkomo/be6YkGvYOUPsQ2wAxXlMmOcHeudt47WY58WxB2dSXgYk62+vM3OMiI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=F04tgpyA; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="F04tgpyA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28E581F000E9; Thu, 25 Jun 2026 21:02:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1782421340; bh=XkdYRNWACqjfdMLIbouS8O2U9Rt1q2+OVzU2w0wqw5I=; h=Date:To:From:Subject; b=F04tgpyAxB/EPv49Bw/t9wj2ePKVqb/vBPYFpkZmdkxVV4pjWle/Jwq8Za9x4+04J uy5kZVL+NeoF/Uvil1a+bHk6z9tUWEReodRDUzjNO+VB1lkRG+E7hBb0MyGLSOteFI 9Vt3aSL/KL+9GLMjMNb0DLmAZqHhCOXKICjgSvR4= Date: Thu, 25 Jun 2026 14:02:19 -0700 To: mm-commits@vger.kernel.org,ziy@nvidia.com,shuah@kernel.org,ritesh.list@gmail.com,osalvador@suse.de,mhocko@kernel.org,linmiaohe@huawei.com,liam.howlett@oracle.com,dev.jain@arm.com,david@kernel.org,sayalip@linux.ibm.com,akpm@linux-foundation.org From: Andrew Morton Subject: + selftests-mm-handle-einval-when-configuring-gigantic-hugepages.patch added to mm-new branch Message-Id: <20260625210220.28E581F000E9@smtp.kernel.org> Precedence: bulk X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The patch titled Subject: selftests/mm: handle EINVAL when configuring gigantic hugepages has been added to the -mm mm-new branch. Its filename is selftests-mm-handle-einval-when-configuring-gigantic-hugepages.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/selftests-mm-handle-einval-when-configuring-gigantic-hugepages.patch This patch will later appear in the mm-new branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Note, mm-new is a provisional staging ground for work-in-progress patches, and acceptance into mm-new is a notification for others take notice and to finish up reviews. Please do not hesitate to respond to review feedback and post updated versions to replace or incrementally fixup patches in mm-new. The mm-new branch of mm.git is not included in linux-next If a few days of testing in mm-new is successful, the patch will me moved into mm.git's mm-unstable branch, which is included in linux-next Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via various branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there most days ------------------------------------------------------ From: Sayali Patil Subject: selftests/mm: handle EINVAL when configuring gigantic hugepages Date: Thu, 25 Jun 2026 18:10:16 +0530 Patch series "selftests/mm: avoid false failures in hugetlb and KSM tests". This series fixes issues in the hugetlb and KSM MM selftest categories that can report failures when the prerequisites for the tests are not satisfied. Patch 1 updates the hugetlb selftest helpers to handle -EINVAL when attempting to configure gigantic HugeTLB pages via nr_hugepages. PowerPC hash MMU pSeries systems expose gigantic hugepage sizes but do not allow runtime allocation of such pages, causing the sysfs write to fail. Handle this case gracefully and continue running the test instead of aborting. Patch 2 fixes the KSM NUMA merge test on systems with memoryless NUMA nodes. The test currently relies on the number of configured NUMA nodes and may attempt allocations on nodes that have no memory, resulting in spurious failures. Count only NUMA nodes that contain memory and skip the test when fewer than two such nodes are available. These changes improve handling of unsupported test configurations and unmet test prerequisites, avoiding spurious failures. This patch (of 2): Some MM selftests attempt to configure the amount of HugeTLB pages of different sizes by writing to nr_hugepages. PowerPC hash MMU pSeries systems advertise gigantic hugepage sizes but do not support runtime allocation of such pages, writes to the corresponding nr_hugepages file fail with -EINVAL. This causes the test to bail out even though the failure is due to a platform limitation rather than the functionality being tested. Treat -EINVAL from the sysfs write as a skipped configuration request and continue running the test instead of failing. Before patch: ------------------------- running ./hugetlb-madvise ------------------------- TAP version 13 1..1 [INFO] detected hugetlb page size: 16777216 KiB [INFO] detected hugetlb page size: 16384 KiB ok 1 MADV_DONTNEED and MADV_REMOVE on hugetlb Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0 Bail out! /sys/kernel/mm/hugepages/hugepages-16777216kB/nr_hugepages write(0) failed: Invalid argument Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0 [FAIL] After patch: ------------------------- running ./hugetlb-madvise ------------------------- TAP version 13 1..1 [INFO] detected hugetlb page size: 16777216 KiB [INFO] detected hugetlb page size: 16384 KiB ok 1 MADV_DONTNEED and MADV_REMOVE on hugetlb Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0 /sys/kernel/mm/hugepages/hugepages-16777216kB/nr_hugepages write(0) failed: Invalid argument [PASS] Link: https://lore.kernel.org/cover.1782365671.git.sayalip@linux.ibm.com Link: https://lore.kernel.org/8bfa921e30eb94072685103f6496784aa23bb166.1782365671.git.sayalip@linux.ibm.com Fixes: 9d07250ea1eb ("selftests/mm: hugepage_settings: add APIs to get and set nr_hugepages") Signed-off-by: Sayali Patil Cc: David Hildenbrand Cc: Dev Jain Cc: Liam Howlett Cc: Miaohe Lin Cc: Michal Hocko Cc: Oscar Salvador Cc: "Ritesh Harjani (IBM)" Cc: Shuah Khan Cc: Zi Yan Signed-off-by: Andrew Morton --- tools/testing/selftests/mm/vm_util.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/tools/testing/selftests/mm/vm_util.c~selftests-mm-handle-einval-when-configuring-gigantic-hugepages +++ a/tools/testing/selftests/mm/vm_util.c @@ -735,6 +735,13 @@ void write_file(const char *path, const saved_errno = errno; close(fd); errno = saved_errno; + + if (numwritten < 0 && errno == EINVAL) { + ksft_print_msg("%s write(%.*s) failed: %s\n", path, + (int)(buflen - 1), buf, strerror(errno)); + return; + } + if (numwritten < 0) ksft_exit_fail_msg("%s write(%.*s) failed: %s\n", path, (int)(buflen - 1), buf, strerror(errno)); _ Patches currently in -mm which might be from sayalip@linux.ibm.com are selftests-mm-handle-einval-when-configuring-gigantic-hugepages.patch selftests-mm-fix-ksm-numa-merge-test-for-systems-with-memoryless-numa-nodes.patch