Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests/mm: fix build failures due to missing MADV_COLLAPSE

MADV_PAGEOUT, MADV_POPULATE_READ, MADV_COLLAPSE are conditionally
defined as necessary. However, that was being done in .c files, and a
new build failure came up that would have been automatically avoided had
these been in a common header file.

So consolidate and move them all to vm_util.h, which fixes the build
failure.

An alternative approach from Muhammad Usama Anjum was: rely on "make
headers" being required, and include asm-generic/mman-common.h. This
works in the sense that it builds, but it still generates warnings about
duplicate MADV_* symbols, and the goal here is to get a fully clean (no
warnings) build here.

Link: https://lkml.kernel.org/r/20230606071637.267103-9-jhubbard@nvidia.com
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Tested-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

John Hubbard and committed by
Andrew Morton
3972ea24 97deb66e

+10 -17
-7
tools/testing/selftests/mm/cow.c
··· 29 29 #include "../kselftest.h" 30 30 #include "vm_util.h" 31 31 32 - #ifndef MADV_PAGEOUT 33 - #define MADV_PAGEOUT 21 34 - #endif 35 - #ifndef MADV_COLLAPSE 36 - #define MADV_COLLAPSE 25 37 - #endif 38 - 39 32 static size_t pagesize; 40 33 static int pagemap_fd; 41 34 static size_t thpsize;
-10
tools/testing/selftests/mm/khugepaged.c
··· 22 22 23 23 #include "vm_util.h" 24 24 25 - #ifndef MADV_PAGEOUT 26 - #define MADV_PAGEOUT 21 27 - #endif 28 - #ifndef MADV_POPULATE_READ 29 - #define MADV_POPULATE_READ 22 30 - #endif 31 - #ifndef MADV_COLLAPSE 32 - #define MADV_COLLAPSE 25 33 - #endif 34 - 35 25 #define BASE_ADDR ((void *)(1UL << 30)) 36 26 static unsigned long hpage_pmd_size; 37 27 static unsigned long page_size;
+10
tools/testing/selftests/mm/vm_util.h
··· 64 64 65 65 #define PAGEMAP_PRESENT(ent) (((ent) & (1ull << 63)) != 0) 66 66 #define PAGEMAP_PFN(ent) ((ent) & ((1ull << 55) - 1)) 67 + 68 + #ifndef MADV_PAGEOUT 69 + #define MADV_PAGEOUT 21 70 + #endif 71 + #ifndef MADV_POPULATE_READ 72 + #define MADV_POPULATE_READ 22 73 + #endif 74 + #ifndef MADV_COLLAPSE 75 + #define MADV_COLLAPSE 25 76 + #endif