selftests/mm: skip khugepaged file tests if mkfs.xfs is unavailable
Subsystems (3)
PATCH 1/1 selftests/mm: skip khugepaged file tests if mkfs.xfs is unavailable
The XFS setup for ./khugepaged all:file checks that the kernel supports XFS but not that mkfs.xfs is installed. When CONFIG_XFS_FS=y and xfsprogs is missing, mkfs.xfs and mount both fail, but SPLIT_HUGE_PAGE_TEST_XFS_PATH is assigned from mktemp -d and stays set. The test then runs against plain tmpfs and six subtests fail.
The script already has a skip path for this test, but it never runs because the path variable is always set. Check that mkfs.xfs exists before attempting the XFS setup.
--- tools/testing/selftests/mm/run_vmtests.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/mm/run_vmtests.sh +2 -1
@@ -415,7 +415,8 @@ CATEGORY="thp" run_test ./khugepaged -c 4 mthp_khugepaged:anon # Try to create XFS if not provided if [ -z "${SPLIT_HUGE_PAGE_TEST_XFS_PATH}" ]; then if test_selected "thp"; then - if grep xfs /proc/filesystems &>/dev/null; then + if grep xfs /proc/filesystems &>/dev/null && + command -v mkfs.xfs &>/dev/null; then XFS_IMG=$(mktemp /tmp/xfs_img_XXXXXX) SPLIT_HUGE_PAGE_TEST_XFS_PATH=$(mktemp -d /tmp/xfs_dir_XXXXXX) truncate -s 314572800 ${XFS_IMG}
Signature · 1 line
2.43.0
Quoted 11 lines · Jaeyeon Lee
The XFS setup for ./khugepaged all:file checks that the kernel supports XFS but not that mkfs.xfs is installed. When
CONFIG_XFS_FS=yand xfsprogs is missing, mkfs.xfs and mount both fail, butSPLIT_HUGE_PAGE_TEST_XFS_PATHis assigned from mktemp -d and stays set. The test then runs against plain tmpfs and six subtests fail.The script already has a skip path for this test, but it never runs because the path variable is always set. Check that mkfs.xfs exists before attempting the XFS setup.
Assisted-by claude.ai:claude-opus-5
Convention is now:
See https://docs.kernel.org/process/coding-assistants.html
Quoted 1 line
Signed-off-by Jaeyeon Lee <[email protected]>
This seems sensible, so with the tag fixed:
Quoted 19 lines
--- tools/testing/selftests/mm/run_vmtests.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/testing/selftests/mm/run_vmtests.sh +2
-2@@ -415,7 +415,8 @@ CATEGORY="thp" run_test ./khugepaged -c 4 mthp_khugepaged:anon # Try to create XFS if not provided if [ -z "${SPLIT_HUGE_PAGE_TEST_XFS_PATH}" ]; then if test_selected "thp"; then - if grep xfs /proc/filesystems &>/dev/null; then + if grep xfs /proc/filesystems &>/dev/null && + command -v mkfs.xfs &>/dev/null; then XFS_IMG=$(mktemp /tmp/xfs_img_XXXXXX) SPLIT_HUGE_PAGE_TEST_XFS_PATH=$(mktemp -d /tmp/xfs_dir_XXXXXX) truncate -s 314572800 ${XFS_IMG} --
Quoted 2 lines
2.43.0
--
Cheers, Lorenzo
Andrew Morton
maintainerQuoted 7 lines · On Fri, 11 Sep 2026 14:01:55 +0100 "Lorenzo Stoakes (ARM)" <[email protected]>…
Quoted 1 line
Assisted-by claude.ai:claude-opus-5Convention is now:
Assisted-by LLM
Yeah. That's so lame. I like seeing what people are using - it's interesting.
Also tautological. What else will we ever place after "Assisted-by: "? Dr Watson?
Quoted 22 lines · Jaeyeon Lee
The XFS setup for ./khugepaged all:file checks that the kernel supports XFS but not that mkfs.xfs is installed. When
CONFIG_XFS_FS=yand xfsprogs is missing, mkfs.xfs and mount both fail, butSPLIT_HUGE_PAGE_TEST_XFS_PATHis assigned from mktemp -d and stays set. The test then runs against plain tmpfs and six subtests fail.The script already has a skip path for this test, but it never runs because the path variable is always set. Check that mkfs.xfs exists before attempting the XFS setup.
Assisted-by claude.ai:claude-opus-5Signed-off-by Jaeyeon Lee <[email protected]>--- tools/testing/selftests/mm/run_vmtests.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)tools/testing/selftests/mm/run_vmtests.sh +0
-0
tools/testing/selftests/mm/run_vmtests.sh CATEGORY="thp" run_test ./khugepaged -c 4 mthp_khugepaged:anon · line 422
Quoted 9 lines
tools/testing/selftests/mm/run_vmtests.sh +2
-1@@ -415,7 +415,8 @@ CATEGORY="thp" run_test ./khugepaged -c 4 mthp_khugepaged:anon # Try to create XFS if not provided if [ -z "${SPLIT_HUGE_PAGE_TEST_XFS_PATH}" ]; then if test_selected "thp"; then - if grep xfs /proc/filesystems &>/dev/null; then + if grep xfs /proc/filesystems &>/dev/null && + command -v mkfs.xfs &>/dev/null; then XFS_IMG=$(mktemp /tmp/xfs_img_XXXXXX) SPLIT_HUGE_PAGE_TEST_XFS_PATH=$(mktemp -d /tmp/xfs_dir_XXXXXX) truncate -s 314572800 ${XFS_IMG}
This might be more robust, since it can detect mkfs.xfs and mount failures.
if grep xfs /proc/filesystems &>/dev/null; then
XFS_IMG=$(mktemp /tmp/xfs_img_XXXXXX)
XFS_DIR=$(mktemp -d /tmp/xfs_dir_XXXXXX)
truncate -s 314572800 ${XFS_IMG}
if mkfs.xfs -q ${XFS_IMG} && mount -t xfs -o loop ${XFS_IMG} ${XFS_DIR}; then
SPLIT_HUGE_PAGE_TEST_XFS_PATH=${XFS_DIR}
MOUNTED_XFS=1
else
rmdir ${XFS_DIR}
rm -f ${XFS_IMG}
fi
fiBest Regards,
Yan, Zi
Quoted 4 lines · Andrew Morton
Quoted 2 lines · On Fri, 11 Sep 2026 14:01:55 +0100 "Lorenzo Stoakes (ARM)" <[email protected]>…
Quoted 1 line
Assisted-by claude.ai:claude-opus-5
Quoted 8 lines
Quoted 5 lines
Convention is now:
Assisted-by LLMYeah. That's so lame. I like seeing what people are using - it's interesting.
It is like free advertising for these model[1], like I guessed.
Quoted 3 lines
Also tautological. What else will we ever place after "Assisted-by: "? Dr Watson?
Best Regards,
Yan, Zi
Quoted 14 lines · Zi Yan
This might be more robust, since it can detect mkfs.xfs and mount failures.
if grep xfs /proc/filesystems &>/dev/null; then XFS_IMG=$(mktemp /tmp/xfs_img_XXXXXX) XFS_DIR=$(mktemp -d /tmp/xfs_dir_XXXXXX) truncate -s 314572800 ${XFS_IMG} if mkfs.xfs -q ${XFS_IMG} && mount -t xfs -o loop ${XFS_IMG} ${XFS_DIR}; then SPLIT_HUGE_PAGE_TEST_XFS_PATH=${XFS_DIR} MOUNTED_XFS=1 else rmdir ${XFS_DIR} rm -f ${XFS_IMG} fi fi
I'll send v2 with this, adding a Suggested-by: tag and fixing the
Thanks for the review.
Best regards,
Jaeyeon Lee