[LTP] [RFC PATCH 1/2] lib: add support for kinds of hpsize reservation

Li Wang liwang@redhat.com
Thu Sep 7 14:52:32 CEST 2023


On Thu, Sep 7, 2023 at 8:37 PM Li Wang <liwang@redhat.com> wrote:


> >       if (val != tst_hugepages)
>> >               tst_brk(TCONF, "nr_hugepages = %lu, but expect %lu. "
>> >                               "Not enough hugepages for testing.",
>> >                               val, tst_hugepages);
>> >
>> > -     if (hp->policy == TST_NEEDS) {
>> > +     if ((hp->policy == TST_NEEDS) && (!hp->hpsize)) {
>>
>> This branch shouldn't be disabled for TST_NEEDS case, shouldn't there be
>> HugePages_Free-$(size)kB ?
>>
>
>
> No, this is necessary.
>
> Unless the kernel booting with parameter 'default_hugepagesz=1G' otherwise
> there won't be any info about gigantic pages in /proc/meminfo, because
> Linux
> only set the default hugepage size(2MB for x86_64) to
> HugePages_Free-$(size)kB.
>

And, here we probably need add additional check branch for:
    '/sys/kernel/mm/hugepages/hugepages-1048576kB/free_hugepages'
to guarantee the TST_NEEDS behavior is consistent with the default hugepage.


-- 
Regards,
Li Wang


More information about the ltp mailing list