Re: [PATCH v2 1/2] selftest/vm: Use correct PAGE_SHIFT value for ppc64

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

 



Hi Aneesh,

On Fri, Feb 11, 2022 at 05:22:13PM +0530, Aneesh Kumar K V wrote:
> On 2/11/22 16:03, Mike Rapoport wrote:
> > On Fri, Feb 11, 2022 at 12:03:28PM +0530, Aneesh Kumar K.V wrote:
> > > Keep it simple by using a #define and limiting hugepage size to 2M.
> > > This keeps the test simpler instead of dynamically finding the page size
> > > and huge page size.
> > > 
> > > Without this tests are broken w.r.t reading /proc/self/pagemap
> > > 
> > > 	if (pread(pagemap_fd, ent, sizeof(ent),
> > > 			(uintptr_t)ptr >> (PAGE_SHIFT - 3)) != sizeof(ent))
> > > 		err(2, "read pagemap");
> > > 
> > > Cc: Shuah Khan <shuah@xxxxxxxxxx>
> > > Cc: linux-kselftest@xxxxxxxxxxxxxxx
> > > Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxx>
> > > ---
> > >   tools/testing/selftests/vm/ksm_tests.c        | 9 ++++++++-
> > >   tools/testing/selftests/vm/transhuge-stress.c | 9 ++++++++-
> > >   2 files changed, 16 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/tools/testing/selftests/vm/ksm_tests.c b/tools/testing/selftests/vm/ksm_tests.c
> > > index 1436e1a9a3d3..cae72872152b 100644
> > > --- a/tools/testing/selftests/vm/ksm_tests.c
> > > +++ b/tools/testing/selftests/vm/ksm_tests.c
> > > @@ -22,7 +22,14 @@
> > >   #define KSM_MERGE_ACROSS_NODES_DEFAULT true
> > >   #define MB (1ul << 20)
> > > -#define PAGE_SHIFT 12
> > > +#ifdef __powerpc64__
> > > +#define PAGE_SHIFT	16
> > > +#else
> > > +#define PAGE_SHIFT	12
> > > +#endif
> > 
> > Page size can be other than 4096 for other configurations as well. And even
> > on ppc64 it's not necessarily 64k.
> > 
> 
> But most common test config is with 64K page size.
> 
> > Ideally page size in selftests/vm should be sysconf(_SC_PAGESIZE)
> 
> 
> yes. As explained in commit message, the idea was to keep it simpler.

I think it's simple enough (compile tested on x86 only):


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux