* [PATCH] selftests/mm: hmm-tests: include linux/mman.h to access MADV_COLLAPSE
@ 2026-06-28 14:31 Zenghui Yu
2026-06-29 10:20 ` Lorenzo Stoakes
2026-06-30 8:59 ` Dev Jain
0 siblings, 2 replies; 3+ messages in thread
From: Zenghui Yu @ 2026-06-28 14:31 UTC (permalink / raw)
To: linux-mm, linux-kselftest, linux-kernel
Cc: jgg, leon, akpm, david, ljs, liam, vbabka, rppt, surenb, mhocko,
shuah, dev.jain, Zenghui Yu
The following compilation error occurs with an old version of glibc due to
a recent commit adding MADV_COLLAPSE testing:
[root@localhost mm]# getconf GNU_LIBC_VERSION
glibc 2.34
[root@localhost mm]# make
CC hmm-tests
hmm-tests.c: In function 'hmm_migrate_anon_huge_fault':
hmm-tests.c:2355:27: error: 'MADV_COLLAPSE' undeclared (first use in this function); did you mean 'MADV_COLD'?
2355 | ret = madvise(map, size, MADV_COLLAPSE);
| ^~~~~~~~~~~~~
| MADV_COLD
hmm-tests.c:2355:27: note: each undeclared identifier is reported only once for each function it appears in
make: *** [../lib.mk:225: /root/code/linux/tools/testing/selftests/mm/hmm-tests] Error 1
Include linux/mman.h (which provides the definition of MADV_COLLAPSE) to
fix the build error.
Fixes: e3d8707358ea ("selftests/mm/hmm-tests: test pagemap reads of PMD device-private entries")
Signed-off-by: Zenghui Yu <zenghui.yu@linux.dev>
---
tools/testing/selftests/mm/hmm-tests.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/mm/hmm-tests.c b/tools/testing/selftests/mm/hmm-tests.c
index e4c49699f3f7..2f2b9879d100 100644
--- a/tools/testing/selftests/mm/hmm-tests.c
+++ b/tools/testing/selftests/mm/hmm-tests.c
@@ -23,6 +23,7 @@
#include <time.h>
#include <pthread.h>
#include <limits.h>
+#include <linux/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] selftests/mm: hmm-tests: include linux/mman.h to access MADV_COLLAPSE
2026-06-28 14:31 [PATCH] selftests/mm: hmm-tests: include linux/mman.h to access MADV_COLLAPSE Zenghui Yu
@ 2026-06-29 10:20 ` Lorenzo Stoakes
2026-06-30 8:59 ` Dev Jain
1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Stoakes @ 2026-06-29 10:20 UTC (permalink / raw)
To: Zenghui Yu
Cc: linux-mm, linux-kselftest, linux-kernel, jgg, leon, akpm, david,
liam, vbabka, rppt, surenb, mhocko, shuah, dev.jain
On Sun, Jun 28, 2026 at 10:31:11PM +0800, Zenghui Yu wrote:
> The following compilation error occurs with an old version of glibc due to
> a recent commit adding MADV_COLLAPSE testing:
>
> [root@localhost mm]# getconf GNU_LIBC_VERSION
> glibc 2.34
> [root@localhost mm]# make
> CC hmm-tests
> hmm-tests.c: In function 'hmm_migrate_anon_huge_fault':
> hmm-tests.c:2355:27: error: 'MADV_COLLAPSE' undeclared (first use in this function); did you mean 'MADV_COLD'?
> 2355 | ret = madvise(map, size, MADV_COLLAPSE);
> | ^~~~~~~~~~~~~
> | MADV_COLD
> hmm-tests.c:2355:27: note: each undeclared identifier is reported only once for each function it appears in
> make: *** [../lib.mk:225: /root/code/linux/tools/testing/selftests/mm/hmm-tests] Error 1
>
> Include linux/mman.h (which provides the definition of MADV_COLLAPSE) to
> fix the build error.
>
> Fixes: e3d8707358ea ("selftests/mm/hmm-tests: test pagemap reads of PMD device-private entries")
> Signed-off-by: Zenghui Yu <zenghui.yu@linux.dev>
LGTM, so:
Reviewed-by: Lorenzo Stoakes <ljs@kernel.org>
> ---
> tools/testing/selftests/mm/hmm-tests.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/testing/selftests/mm/hmm-tests.c b/tools/testing/selftests/mm/hmm-tests.c
> index e4c49699f3f7..2f2b9879d100 100644
> --- a/tools/testing/selftests/mm/hmm-tests.c
> +++ b/tools/testing/selftests/mm/hmm-tests.c
> @@ -23,6 +23,7 @@
> #include <time.h>
> #include <pthread.h>
> #include <limits.h>
> +#include <linux/mman.h>
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <sys/mman.h>
> --
> 2.53.0
>
Cheers, Lorenzo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] selftests/mm: hmm-tests: include linux/mman.h to access MADV_COLLAPSE
2026-06-28 14:31 [PATCH] selftests/mm: hmm-tests: include linux/mman.h to access MADV_COLLAPSE Zenghui Yu
2026-06-29 10:20 ` Lorenzo Stoakes
@ 2026-06-30 8:59 ` Dev Jain
1 sibling, 0 replies; 3+ messages in thread
From: Dev Jain @ 2026-06-30 8:59 UTC (permalink / raw)
To: Zenghui Yu, linux-mm, linux-kselftest, linux-kernel
Cc: jgg, leon, akpm, david, ljs, liam, vbabka, rppt, surenb, mhocko,
shuah
On 28/06/26 8:01 pm, Zenghui Yu wrote:
> The following compilation error occurs with an old version of glibc due to
> a recent commit adding MADV_COLLAPSE testing:
>
> [root@localhost mm]# getconf GNU_LIBC_VERSION
> glibc 2.34
> [root@localhost mm]# make
> CC hmm-tests
> hmm-tests.c: In function 'hmm_migrate_anon_huge_fault':
> hmm-tests.c:2355:27: error: 'MADV_COLLAPSE' undeclared (first use in this function); did you mean 'MADV_COLD'?
> 2355 | ret = madvise(map, size, MADV_COLLAPSE);
> | ^~~~~~~~~~~~~
> | MADV_COLD
> hmm-tests.c:2355:27: note: each undeclared identifier is reported only once for each function it appears in
> make: *** [../lib.mk:225: /root/code/linux/tools/testing/selftests/mm/hmm-tests] Error 1
>
> Include linux/mman.h (which provides the definition of MADV_COLLAPSE) to
> fix the build error.
>
> Fixes: e3d8707358ea ("selftests/mm/hmm-tests: test pagemap reads of PMD device-private entries")
> Signed-off-by: Zenghui Yu <zenghui.yu@linux.dev>
> ---
Reviewed-by: Dev Jain <dev.jain@arm.com>
> tools/testing/selftests/mm/hmm-tests.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/testing/selftests/mm/hmm-tests.c b/tools/testing/selftests/mm/hmm-tests.c
> index e4c49699f3f7..2f2b9879d100 100644
> --- a/tools/testing/selftests/mm/hmm-tests.c
> +++ b/tools/testing/selftests/mm/hmm-tests.c
> @@ -23,6 +23,7 @@
> #include <time.h>
> #include <pthread.h>
> #include <limits.h>
> +#include <linux/mman.h>
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <sys/mman.h>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-30 8:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-28 14:31 [PATCH] selftests/mm: hmm-tests: include linux/mman.h to access MADV_COLLAPSE Zenghui Yu
2026-06-29 10:20 ` Lorenzo Stoakes
2026-06-30 8:59 ` Dev Jain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox