From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
To: linux-mm@kvack.org, akpm@linux-foundation.org
Cc: Shuah Khan <shuah@kernel.org>,
linuxppc-dev@lists.ozlabs.org, linux-kselftest@vger.kernel.org,
"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
Subject: [PATCH v2 1/2] selftest/vm: Use correct PAGE_SHIFT value for ppc64
Date: Fri, 11 Feb 2022 12:03:28 +0530 [thread overview]
Message-ID: <20220211063330.99648-1-aneesh.kumar@linux.ibm.com> (raw)
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>
Cc: linux-kselftest@vger.kernel.org
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
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
+/*
+ * On ppc64 this will only work with radix 2M hugepage size
+ */
#define HPAGE_SHIFT 21
#define PAGE_SIZE (1 << PAGE_SHIFT)
diff --git a/tools/testing/selftests/vm/transhuge-stress.c b/tools/testing/selftests/vm/transhuge-stress.c
index 5e4c036f6ad3..b1f8d98355c5 100644
--- a/tools/testing/selftests/vm/transhuge-stress.c
+++ b/tools/testing/selftests/vm/transhuge-stress.c
@@ -16,7 +16,14 @@
#include <string.h>
#include <sys/mman.h>
-#define PAGE_SHIFT 12
+#ifdef __powerpc64__
+#define PAGE_SHIFT 16
+#else
+#define PAGE_SHIFT 12
+#endif
+/*
+ * On ppc64 this will only work with radix 2M hugepage size
+ */
#define HPAGE_SHIFT 21
#define PAGE_SIZE (1 << PAGE_SHIFT)
--
2.34.1
next reply other threads:[~2022-02-11 6:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-11 6:33 Aneesh Kumar K.V [this message]
2022-02-11 6:33 ` [PATCH v2 2/2] selftest/vm: Add util.h and and move helper functions there Aneesh Kumar K.V
2022-02-11 10:33 ` [PATCH v2 1/2] selftest/vm: Use correct PAGE_SHIFT value for ppc64 Mike Rapoport
2022-02-11 11:52 ` Aneesh Kumar K V
2022-02-11 13:28 ` Mike Rapoport
2022-02-11 13:55 ` Aneesh Kumar K V
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=20220211063330.99648-1-aneesh.kumar@linux.ibm.com \
--to=aneesh.kumar@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=shuah@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).