Re: [PATCH] selftests/mm: load xfs before checking for it in run_vmtests.sh

From: Zi Yan

Date: Fri Oct 16 2026 - 09:56:05 EST


On 16 Oct 2026, at 8:54, Qiliang Yuan wrote:

> run_vmtests.sh creates a loop-mounted XFS for "khugepaged all:file" and
> for the pagecache folio split cases of split_huge_page_test, since
> tmpfs does not give them large pagecache folios.
>
> It only does so when xfs already shows up in /proc/filesystems. When
> xfs is built as a module that is not loaded yet, the check fails, no
> XFS is created, "khugepaged all:file" is reported as skipped and every
> pagecache folio split case of split_huge_page_test is skipped with "No
> large pagecache folio generated".
>
> Try to load the module when xfs is not registered yet.
>
> "run_vmtests.sh -a -t thp" with xfs built as a module and not loaded:
>
> before after
> skipped tests 1 0
> skipped split_huge_page_test cases 43 0
>
> Fixes: fc4d182316bd ("mm: huge_memory: enable debugfs to split huge pages to any order")
> Signed-off-by: Qiliang Yuan <odys.yuan@xxxxxxxxx>
> ---
> tools/testing/selftests/mm/run_vmtests.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Instead of doing ad hoc fixes, it might be better to add some generic code
to load necessary kernel modules and unload them after the test is done.

>
> diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh
> index a1b45a3dedaee..6b754555d5734 100755
> --- a/tools/testing/selftests/mm/run_vmtests.sh
> +++ b/tools/testing/selftests/mm/run_vmtests.sh
> @@ -399,7 +399,7 @@ CATEGORY="thp" run_test ./khugepaged -s 4 all:shmem
> # 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 -q xfs /proc/filesystems || modprobe -q xfs 2>/dev/null; then
> XFS_IMG=$(mktemp /tmp/xfs_img_XXXXXX)
> XFS_DIR=$(mktemp -d /tmp/xfs_dir_XXXXXX)
> truncate -s 314572800 ${XFS_IMG}

If xfs is not loaded before run, it should be unloaded afterwards, right?

>
> ---
> base-commit: 437a7e839def0f505277022622fc59a8b071d6cf
> change-id: 20261016-bug-selftests-mm-run-vmtests-xfs-modprobe-de0697d4c4e9
>
> Best regards,
> --
> Qiliang Yuan <odys.yuan@xxxxxxxxx>


Best Regards,
Yan, Zi