Thread (22 messages) 22 messages, 5 authors, 2025-09-08

Re: [PATCH v5 6/7] selftests: prctl: introduce tests for disabling THPs completely

From: Usama Arif <hidden>
Date: 2025-09-05 19:40:29
Also in: linux-fsdevel, linux-mm, lkml
Subsystem: kernel selftest framework, memory management - misc, the rest · Maintainers: Shuah Khan, Andrew Morton, David Hildenbrand, Linus Torvalds


On 05/09/2025 19:02, Mark Brown wrote:
On Fri, Sep 05, 2025 at 01:55:53PM -0400, Zi Yan wrote:
quoted
On 5 Sep 2025, at 13:43, Mark Brown wrote:
quoted
quoted
but the header there is getting ignored AFAICT.  Probably the problem is
fairly obvious and I'm just being slow - I'm not quite 100% at the
minute.
quoted
prctl_thp_disable.c uses “#include <sys/mman.h>” but asm-generic/mman-common.h
is included in asm/mman.h. And sys/mman.h gets MADV_COLLAPSE from
bits/mman-linux.h. Maybe that is why?
Ah, of course - if glibc is reproducing the kernel definitions rather
than including the kernel headers to get them then that'd do it.
Probably the test needs to locally define the new MADV_COLLAPSE for
glibc compatibility, IME trying to directly include the kernel headers
when glibc doesn't normally use them tends to blow up on you sooner or
later.

I knew it'd be something simple, thanks.
Hi Mark,

Thanks for raising this. I think doing 
diff --git a/tools/testing/selftests/mm/prctl_thp_disable.c b/tools/testing/selftests/mm/prctl_thp_disable.c
index 89ed0d7db1c16..0afcdbad94f3d 100644
--- a/tools/testing/selftests/mm/prctl_thp_disable.c
+++ b/tools/testing/selftests/mm/prctl_thp_disable.c
@@ -9,6 +9,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <sys/mman.h>
+#include <linux/mman.h>
 #include <sys/prctl.h>
 #include <sys/wait.h>

should fix this issue?

Thanks
Usama
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help