Re: [PATCH v4 7/7] selftests: prctl: introduce tests for disabling THPs except for madvise

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



+cc Mark who might have insights here

On Thu, Aug 14, 2025 at 11:32:55AM +0200, David Hildenbrand wrote:
> On 13.08.25 20:52, Lorenzo Stoakes wrote:
> > On Wed, Aug 13, 2025 at 06:24:11PM +0200, David Hildenbrand wrote:
> > > > > +
> > > > > +FIXTURE_SETUP(prctl_thp_disable_except_madvise)
> > > > > +{
> > > > > +	if (!thp_available())
> > > > > +		SKIP(return, "Transparent Hugepages not available\n");
> > > > > +
> > > > > +	self->pmdsize = read_pmd_pagesize();
> > > > > +	if (!self->pmdsize)
> > > > > +		SKIP(return, "Unable to read PMD size\n");
> > > > > +
> > > > > +	if (prctl(PR_SET_THP_DISABLE, 1, PR_THP_DISABLE_EXCEPT_ADVISED, NULL, NULL))
> > > > > +		SKIP(return, "Unable to set PR_THP_DISABLE_EXCEPT_ADVISED\n");
> > > >
> > > > This should be a test fail I think, as the only ways this could fail are
> > > > invalid flags, or failure to obtain an mmap write lock.
> > >
> > > Running a kernel that does not support it?
> >
> > I can't see anything in the kernel to #ifdef it out so I suppose you mean
> > running these tests on an older kernel?
>
> Yes.
>
> >
> > But this is an unsupported way of running self-tests, they are tied to the
> > kernel version in which they reside, and test that specific version.
> >
> > Unless I'm missing something here?
>
> I remember we allow for a bit of flexibility when it is simple to handle.
>
> Is that documented somewhere?

Not sure if it's documented, but it'd make testing extremely egregious if
you had to consider all of the possible kernels and interactions and etc.

I think it's 'if it happens to work then fine' but otherwise it is expected
that the tests match the kernel.

It's also very neat that with a revision you get a set of (hopefully)
working tests for that revision :)

>
> >
> > >
> > > We could check the errno to distinguish I guess.
> >
> > Which one? manpage says -EINVAL, but can also be due to incorrect invocation,
> > which would mean a typo could mean tests pass but your tests do nothing :)
>
> Right, no ENOSYS in that case to distinguish :(

Yup sadly

>
> --
> Cheers
>
> David / dhildenb
>




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux