Skip to contentSkip to conversation

selftests/mm: skip khugepaged file tests if mkfs.xfs is unavailable

PATCH Superseded Jaeyeon Lee 4 participants 6 messages Sep 11 – Sep 12

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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.

Assisted-by claude.ai:claude-opus-5
---
 tools/testing/selftests/mm/run_vmtests.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/mm/run_vmtests.sh +2 -1
index d09f9f6a384e..6315b67b6733 100755
@@ -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
reviewer Reviewed-by on v1 1/1
#1 lore raw
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=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.

Assisted-by claude.ai:claude-opus-5

Convention is now:

Assisted-by LLM

See https://docs.kernel.org/process/coding-assistants.html

Quoted 1 line

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
index d09f9f6a384e..6315b67b6733 100755
@@ -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

#3 lore raw
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 LLM

See https://docs.kernel.org/process/coding-assistants.html

Yeah. 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?

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=816d9992d9ed434ec52cfbd63080d518e535a41b

Best Regards,
Yan, Zi

#4 lore raw
In reply to Jaeyeon Lee
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=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.

Assisted-by claude.ai:claude-opus-5
---
 tools/testing/selftests/mm/run_vmtests.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/mm/run_vmtests.sh +0 -0
index d09f9f6a384e..6315b67b6733 100755

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
  fi

Best Regards,
Yan, Zi

#5 lore raw
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

Assisted-by tag format.

Thanks for the review.

Best regards,
Jaeyeon Lee