Hi Mike!
On 5/24/26 10:36 PM, Mike Rapoport wrote:
> On Thu, 21 May 2026 16:47:59 +0530, Sarthak Sharma <[email protected]>
> 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.
I removed this because hugepage_settings.c is now moving out of
selftests, and converting the ksft_print_msg() calls to plain printf()
would break TAP output for selftests.
I can add these diagnostic lines back, but since this is now a shared
helper, in order to preserve TAP compatibility, I'll have to do a
fprintf(stderr, "# ..."). I feel this would look a bit odd from a
non-selftest invocation though.
Another option is to add a logging hook so selftests can wire this to
ksft_print_msg() while non-selftest users can use normal stderr, but
that feels too much for 2 print statements and would extend the scope of
this series.
Please let me know if you have a preference here.
>
>> @@ -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.
Yeah I can do this for files that already include vm_util.h.