From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
To: Shuah Khan <skhan@linuxfoundation.org>,
linux-mm@kvack.org, akpm@linux-foundation.org
Cc: Shuah Khan <shuah@kernel.org>,
linuxppc-dev@lists.ozlabs.org,
Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] selftest/vm: Use correct PAGE_SHIFT value for ppc64
Date: Thu, 10 Feb 2022 09:42:21 +0530 [thread overview]
Message-ID: <87zgmz9x7e.fsf@linux.ibm.com> (raw)
In-Reply-To: <84508bb4-9400-f429-e6d2-d8b05a1e8368@linuxfoundation.org>
Shuah Khan <skhan@linuxfoundation.org> writes:
> On 2/9/22 8:43 AM, 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@kernel.org>
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>> ---
>> tools/testing/selftests/vm/ksm_tests.c | 8 ++++++++
>> tools/testing/selftests/vm/transhuge-stress.c | 8 ++++++++
>> 2 files changed, 16 insertions(+)
>>
>> diff --git a/tools/testing/selftests/vm/ksm_tests.c b/tools/testing/selftests/vm/ksm_tests.c
>> index 1436e1a9a3d3..8200328ff018 100644
>> --- a/tools/testing/selftests/vm/ksm_tests.c
>> +++ b/tools/testing/selftests/vm/ksm_tests.c
>> @@ -22,8 +22,16 @@
>> #define KSM_MERGE_ACROSS_NODES_DEFAULT true
>> #define MB (1ul << 20)
>>
>> +#ifdef __powerpc64__
>> +#define PAGE_SHIFT 16
>> +/*
>> + * This will only work with radix 2M hugepage size
>> + */
>> +#define HPAGE_SHIFT 21
>> +#else
>> #define PAGE_SHIFT 12
>> #define HPAGE_SHIFT 21
>> +#endif
>>
>> #define PAGE_SIZE (1 << PAGE_SHIFT)
>> #define HPAGE_SIZE (1 << HPAGE_SHIFT)
>> diff --git a/tools/testing/selftests/vm/transhuge-stress.c b/tools/testing/selftests/vm/transhuge-stress.c
>> index 5e4c036f6ad3..f04c8aa4bcf6 100644
>> --- a/tools/testing/selftests/vm/transhuge-stress.c
>> +++ b/tools/testing/selftests/vm/transhuge-stress.c
>> @@ -16,8 +16,16 @@
>> #include <string.h>
>> #include <sys/mman.h>
>>
>> +#ifdef __powerpc64__
>> +#define PAGE_SHIFT 16
>> +/*
>> + * This will only work with radix 2M hugepage size
>> + */
>> +#define HPAGE_SHIFT 21
>
> Why not have this is in common code?
Can you suggest where I can move that. We also have helper functions
like allocate_transhuge() duplicated between tests. I didn't find
libutil.a or anything similar supported by the selftets build.
>
>> +#else
>> #define PAGE_SHIFT 12
>> #define HPAGE_SHIFT 21
>
> Same here.
>
>> +#endif
>>
>> #define PAGE_SIZE (1 << PAGE_SHIFT)
>> #define HPAGE_SIZE (1 << HPAGE_SHIFT)
>>
>
> Please cc linux-kselftest mailing list in the future.
>
> With the above fixed.
>
> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
>
> thanks,
> -- Shuah
-aneesh
WARNING: multiple messages have this Message-ID (diff)
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
To: Shuah Khan <skhan@linuxfoundation.org>,
linux-mm@kvack.org, akpm@linux-foundation.org
Cc: mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org,
Shuah Khan <shuah@kernel.org>,
Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH] selftest/vm: Use correct PAGE_SHIFT value for ppc64
Date: Thu, 10 Feb 2022 09:42:21 +0530 [thread overview]
Message-ID: <87zgmz9x7e.fsf@linux.ibm.com> (raw)
In-Reply-To: <84508bb4-9400-f429-e6d2-d8b05a1e8368@linuxfoundation.org>
Shuah Khan <skhan@linuxfoundation.org> writes:
> On 2/9/22 8:43 AM, 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@kernel.org>
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>> ---
>> tools/testing/selftests/vm/ksm_tests.c | 8 ++++++++
>> tools/testing/selftests/vm/transhuge-stress.c | 8 ++++++++
>> 2 files changed, 16 insertions(+)
>>
>> diff --git a/tools/testing/selftests/vm/ksm_tests.c b/tools/testing/selftests/vm/ksm_tests.c
>> index 1436e1a9a3d3..8200328ff018 100644
>> --- a/tools/testing/selftests/vm/ksm_tests.c
>> +++ b/tools/testing/selftests/vm/ksm_tests.c
>> @@ -22,8 +22,16 @@
>> #define KSM_MERGE_ACROSS_NODES_DEFAULT true
>> #define MB (1ul << 20)
>>
>> +#ifdef __powerpc64__
>> +#define PAGE_SHIFT 16
>> +/*
>> + * This will only work with radix 2M hugepage size
>> + */
>> +#define HPAGE_SHIFT 21
>> +#else
>> #define PAGE_SHIFT 12
>> #define HPAGE_SHIFT 21
>> +#endif
>>
>> #define PAGE_SIZE (1 << PAGE_SHIFT)
>> #define HPAGE_SIZE (1 << HPAGE_SHIFT)
>> diff --git a/tools/testing/selftests/vm/transhuge-stress.c b/tools/testing/selftests/vm/transhuge-stress.c
>> index 5e4c036f6ad3..f04c8aa4bcf6 100644
>> --- a/tools/testing/selftests/vm/transhuge-stress.c
>> +++ b/tools/testing/selftests/vm/transhuge-stress.c
>> @@ -16,8 +16,16 @@
>> #include <string.h>
>> #include <sys/mman.h>
>>
>> +#ifdef __powerpc64__
>> +#define PAGE_SHIFT 16
>> +/*
>> + * This will only work with radix 2M hugepage size
>> + */
>> +#define HPAGE_SHIFT 21
>
> Why not have this is in common code?
Can you suggest where I can move that. We also have helper functions
like allocate_transhuge() duplicated between tests. I didn't find
libutil.a or anything similar supported by the selftets build.
>
>> +#else
>> #define PAGE_SHIFT 12
>> #define HPAGE_SHIFT 21
>
> Same here.
>
>> +#endif
>>
>> #define PAGE_SIZE (1 << PAGE_SHIFT)
>> #define HPAGE_SIZE (1 << HPAGE_SHIFT)
>>
>
> Please cc linux-kselftest mailing list in the future.
>
> With the above fixed.
>
> Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
>
> thanks,
> -- Shuah
-aneesh
next prev parent reply other threads:[~2022-02-10 4:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-09 15:43 [PATCH] selftest/vm: Use correct PAGE_SHIFT value for ppc64 Aneesh Kumar K.V
2022-02-09 15:43 ` Aneesh Kumar K.V
2022-02-09 19:53 ` Shuah Khan
2022-02-09 19:53 ` Shuah Khan
2022-02-10 4:12 ` Aneesh Kumar K.V [this message]
2022-02-10 4:12 ` Aneesh Kumar K.V
2022-02-10 5:35 ` Aneesh Kumar K.V
2022-02-10 5:35 ` Aneesh Kumar K.V
2022-02-10 14:39 ` Shuah Khan
2022-02-10 14:39 ` Shuah Khan
2022-02-10 15:03 ` Aneesh Kumar K V
2022-02-10 15:03 ` Aneesh Kumar K V
2022-02-10 15:08 ` Shuah Khan
2022-02-10 15:08 ` Shuah Khan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zgmz9x7e.fsf@linux.ibm.com \
--to=aneesh.kumar@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.