On 5/20/26 6:28 PM, Mike Rapoport wrote:
> On Wed, May 20, 2026 at 12:58:32PM +0100, Mark Brown wrote:
>> On Wed, May 20, 2026 at 03:45:53PM +0530, Sarthak Sharma wrote:
>>> On 5/20/26 2:25 PM, Mike Rapoport wrote:
>>
>>>> It seems that we need to better share the common code in
>>>> tools/testing/selftest.
>>
>>>> And adding another copy of the hugetlb detection and setup code does not
>>>> seem like a great idea.
>>
>>> Agreed, but that was the least disruptive approach I could think of.
>>
>>> I am thinking of doing this now: should I move the
>>> hugepage_settings.[ch] to tools/lib/ and move the read_num(),
>>> write_num(), read_file() and write_file() helpers to a separate file in
>
> these might need some adjustments because they use ksft_(), but in general
> it makes sense to me.
>
>>> tools/lib/ itself without any ksft dependency? Then both
>>> tools/testing/selftests/* and tools/mm/ could share the same code.
>>
>> Using tools/lib sounds sensible to me - as well as the sharing it makes
>> it clear that it's a library used by multiple things so avoids the
>> issues we sometimes have with selftest directories referencing each
>> other.
>
> I'd make it tools/lib/mm as most of the files tools/lib/*.c are stubs for
> the kernel functions.
>
Thanks Mark and Mike, I'll include these changes in v3.