> > --- a/tools/testing/selftests/mm/hugetlb_dio.c
> > +++ b/tools/testing/selftests/mm/hugetlb_dio.c
> > @@ -20,6 +20,31 @@
> >  #include "vm_util.h"
> >  #include "kselftest.h"
> >  
> > +#ifndef STATX_DIOALIGN
> > +#define STATX_DIOALIGN             0x00002000U
> > +#endif
> > +
> > +void check_dio_alignment(size_t pagesize)
> > +{
> > +   int fd;
> > +   struct statx stx;
> > +   unsigned int dio_align = 1;
> > +
> > +   fd = open("/tmp", O_TMPFILE | O_RDWR, 0664);
> > +   if (fd < 0)
> > +           ksft_exit_skip("Unable to allocate file: %s\n", 
> > strerror(errno));
> > +
> > +   if (statx(fd, "", AT_EMPTY_PATH, STATX_DIOALIGN, &stx) == 0 &&
> > +                           (stx.stx_mask & STATX_DIOALIGN))
> > +           dio_align = stx.stx_dio_offset_align;
> > +
> > +   close(fd);
> > +
> > +   if ((pagesize / 2) % dio_align != 0)
> > +           ksft_exit_skip("DIO alignment (%u) incompatible with sub-page 
> > offset %lu\n",
> > +                           dio_align, pagesize / 2);
> 
> This also needlessly skips the test with aligned offsets.
> 
> I'd suggest detecting dio_align here, passing it to run_dio_using_hugetlb()
> and moving the check that skips a test there.

Good point, as the first test case use 'pagesize * 3' is fully aligned
and would work fine. But apparently I overlooked that.

Also, Sashiko reminder few minor issues, which I would fix them in next
version as well.
  https://sashiko.dev/#/patchset/20260327031243.15903-1-liwang%40redhat.com

-- 
Regards,
Li Wang


Reply via email to