Re: [PATCH v3 2/4] tools/lib/mm: move hugepage_settings out of selftests

From: Mike Rapoport

Date: Sun May 24 2026 - 13:06:35 EST


On Thu, 21 May 2026 16:47:59 +0530, Sarthak Sharma <sarthak.sharma@xxxxxxx> wrote:

Hi Sarthak,

>
> diff --git a/tools/testing/selftests/mm/hugepage_settings.c b/tools/lib/mm/hugepage_settings.c
> similarity index 98%
> rename from tools/testing/selftests/mm/hugepage_settings.c
> rename to tools/lib/mm/hugepage_settings.c
> index 5e947abb7425..b08b27776fc5 100644
> --- a/tools/testing/selftests/mm/hugepage_settings.c
> +++ b/tools/lib/mm/hugepage_settings.c
> @@ -383,8 +387,6 @@ int detect_hugetlb_page_sizes(unsigned long sizes[], int max)
> if (sscanf(entry->d_name, "hugepages-%zukB", &kb) != 1)
> continue;
> sizes[count++] = kb * 1024;
> - ksft_print_msg("[INFO] detected hugetlb page size: %zu KiB\n",
> - kb);

I believe this message is useful for debugging.

> @@ -503,7 +505,6 @@ unsigned long hugetlb_setup(unsigned long nr, unsigned long sizes[],
> return 0;
>
> if (nr_enabled > max) {
> - ksft_print_msg("detected %d huge page sizes, will only test %d\n", nr_enabled, max);

And this one as well.

>
> diff --git a/tools/testing/selftests/mm/compaction_test.c b/tools/testing/selftests/mm/compaction_test.c
> index de0633f9a7e5..7c58506c0aa7 100644
> --- a/tools/testing/selftests/mm/compaction_test.c
> +++ b/tools/testing/selftests/mm/compaction_test.c
> @@ -15,9 +15,9 @@
> #include <errno.h>
> #include <unistd.h>
> #include <string.h>
> +#include <mm/hugepage_settings.h>

As with file_utils.h this can also go to vm_utils.h IMHO.

--
Sincerely yours,
Mike.