Re: [PATCH 2/6] KVM: selftests: Stash the host page size in a global in the guest_memfd test
From: Sean Christopherson
Date: Mon Sep 29 2025 - 12:58:19 EST
On Mon, Sep 29, 2025, Ackerley Tng wrote:
> Sean Christopherson <seanjc@xxxxxxxxxx> writes:
>
> > Use a global variable to track the host page size in the guest_memfd test
> > so that the information doesn't need to be constantly passed around. The
> > state is purely a reflection of the underlying system, i.e. can't be set
> > by the test and is constant for a given invocation of the test, and thus
> > explicitly passing the host page size to individual testcases adds no
> > value, e.g. doesn't allow testing different combinations.
> >
>
> I was going to pass in page_size to each of these test cases to test
> HugeTLB support, that's how page_size crept into the parameters of these
> functions.
>
> Could we do a getpagesize() within the gmem_test() macro that you
> introduced instead?
We could, and I actually had it that way to start. But I found that burying the
effective setting of page_size made it harder to see that it's a runtime constant,
versus something that can be configured by the test.