* [PATCH v3 1/2] selftests/mm: gup_test: stop testing FOLL_TOUCH
@ 2025-11-17 15:40 Peng Li
2025-11-17 15:40 ` [PATCH v3 2/2] selftests/mm: gup_test: fix comment regarding origin of FOLL_WRITE Peng Li
0 siblings, 1 reply; 2+ messages in thread
From: Peng Li @ 2025-11-17 15:40 UTC (permalink / raw)
To: linux-mm, akpm
Cc: david, osalvador, jgg, jhubbard, peterx, linux-kernel,
dan.j.williams, Peng Li, David Hildenbrand
From: Peng Li <peng8420.li@gmail.com>
commit 0f20bba1688b ("mm/gup: explicitly define and check internal GUP
flags, disallow FOLL_TOUCH") marked FOLL_TOUCH as a GUP-internal flag.
This causes a warning to fire when running gup_test, for example:
$ ./gup_test -L -r 100 -z
dmesg:
WARNING: CPU: 1 PID: 117 at mm/gup.c:2512 is_valid_gup_args+0x66/0x8c
Therefore, remove the "FOLL_TOUCH" test code from gup_test.c.
Signed-off-by: Peng Li <peng8420.li@gmail.com>
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
Reviewed-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
tools/testing/selftests/mm/gup_test.c | 22 ++++------------------
1 file changed, 4 insertions(+), 18 deletions(-)
diff --git a/tools/testing/selftests/mm/gup_test.c b/tools/testing/selftests/mm/gup_test.c
index 8900b840c17a..75f7134d529d 100644
--- a/tools/testing/selftests/mm/gup_test.c
+++ b/tools/testing/selftests/mm/gup_test.c
@@ -19,7 +19,6 @@
/* Just the flags we need, copied from mm.h: */
#define FOLL_WRITE 0x01 /* check pte is writable */
-#define FOLL_TOUCH 0x02 /* mark page accessed */
#define GUP_TEST_FILE "/sys/kernel/debug/gup_test"
@@ -93,7 +92,7 @@ int main(int argc, char **argv)
{
struct gup_test gup = { 0 };
int filed, i, opt, nr_pages = 1, thp = -1, write = 1, nthreads = 1, ret;
- int flags = MAP_PRIVATE, touch = 0;
+ int flags = MAP_PRIVATE;
char *file = "/dev/zero";
pthread_t *tid;
char *p;
@@ -170,10 +169,6 @@ int main(int argc, char **argv)
case 'H':
flags |= (MAP_HUGETLB | MAP_ANONYMOUS);
break;
- case 'z':
- /* fault pages in gup, do not fault in userland */
- touch = 1;
- break;
default:
ksft_exit_fail_msg("Wrong argument\n");
}
@@ -244,18 +239,9 @@ int main(int argc, char **argv)
else if (thp == 0)
madvise(p, size, MADV_NOHUGEPAGE);
- /*
- * FOLL_TOUCH, in gup_test, is used as an either/or case: either
- * fault pages in from the kernel via FOLL_TOUCH, or fault them
- * in here, from user space. This allows comparison of performance
- * between those two cases.
- */
- if (touch) {
- gup.gup_flags |= FOLL_TOUCH;
- } else {
- for (; (unsigned long)p < gup.addr + size; p += psize())
- p[0] = 0;
- }
+ /* Fault them in here, from user space. */
+ for (; (unsigned long)p < gup.addr + size; p += psize())
+ p[0] = 0;
tid = malloc(sizeof(pthread_t) * nthreads);
assert(tid);
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread* [PATCH v3 2/2] selftests/mm: gup_test: fix comment regarding origin of FOLL_WRITE
2025-11-17 15:40 [PATCH v3 1/2] selftests/mm: gup_test: stop testing FOLL_TOUCH Peng Li
@ 2025-11-17 15:40 ` Peng Li
0 siblings, 0 replies; 2+ messages in thread
From: Peng Li @ 2025-11-17 15:40 UTC (permalink / raw)
To: linux-mm, akpm
Cc: david, osalvador, jgg, jhubbard, peterx, linux-kernel,
dan.j.williams, Peng Li, David Hildenbrand
From: Peng Li <peng8420.li@gmail.com>
The 'FOLL_WRITE' of the copied source is located in mm_types.h
of mm, not mm.h, so fix it.
Signed-off-by: Peng Li <peng8420.li@gmail.com>
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
Reviewed-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
tools/testing/selftests/mm/gup_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/mm/gup_test.c b/tools/testing/selftests/mm/gup_test.c
index 75f7134d529d..40c1538a17b4 100644
--- a/tools/testing/selftests/mm/gup_test.c
+++ b/tools/testing/selftests/mm/gup_test.c
@@ -17,7 +17,7 @@
#define MB (1UL << 20)
-/* Just the flags we need, copied from mm.h: */
+/* Just the flags we need, copied from the kernel internals. */
#define FOLL_WRITE 0x01 /* check pte is writable */
#define GUP_TEST_FILE "/sys/kernel/debug/gup_test"
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-11-17 15:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-17 15:40 [PATCH v3 1/2] selftests/mm: gup_test: stop testing FOLL_TOUCH Peng Li
2025-11-17 15:40 ` [PATCH v3 2/2] selftests/mm: gup_test: fix comment regarding origin of FOLL_WRITE Peng Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox