David Hildenbrand
d88825f22b
selftests/vm: madv_populate: fix missing MADV_POPULATE_(READ|WRITE) definitions
...
The tests fail to compile in some environments (e.g., Debian 11.5 on x86).
Let's simply conditionally define MADV_POPULATE_(READ|WRITE) if not
already defined, similar to how the khugepaged.c test handles it.
Link: https://lkml.kernel.org/r/20221205193716.276024-3-david@redhat.com
Fixes: 39b2e5cae4 ("selftests/vm: make MADV_POPULATE_(READ|WRITE) use in-tree headers")
Signed-off-by: David Hildenbrand <david@redhat.com >
Cc: Shuah Khan <shuah@kernel.org >
Cc: Yang Li <yang.lee@linux.alibaba.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2022-12-11 18:12:20 -08:00
David Hildenbrand
a905e82ae4
selftests/vm: factor out pagemap_is_populated() into vm_util
...
We'll reuse it in the anon_cow test next.
Link: https://lkml.kernel.org/r/20220927110120.106906-3-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com >
Cc: Andrea Arcangeli <aarcange@redhat.com >
Cc: Christoph von Recklinghausen <crecklin@redhat.com >
Cc: Don Dutile <ddutile@redhat.com >
Cc: Jason Gunthorpe <jgg@nvidia.com >
Cc: John Hubbard <jhubbard@nvidia.com >
Cc: Mike Rapoport <rppt@kernel.org >
Cc: Nadav Amit <namit@vmware.com >
Cc: Peter Xu <peterx@redhat.com >
Cc: Shuah Khan <shuah@kernel.org >
Cc: Vlastimil Babka <vbabka@suse.cz >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2022-11-08 17:37:14 -08:00
Muhammad Usama Anjum
642bc52aed
selftests: vm: bring common functions to a new file
...
Bring common functions to a new file while keeping code as much same as
possible. These functions can be used in the new tests. This helps in
avoiding code duplication.
Link: https://lkml.kernel.org/r/20220420084036.4101604-1-usama.anjum@collabora.com
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com >
Acked-by: David Hildenbrand <david@redhat.com >
Cc: Gabriel Krisman Bertazi <krisman@collabora.com >
Cc: Shuah Khan <shuah@kernel.org >
Cc: Will Deacon <will@kernel.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
2022-04-28 23:16:11 -07:00
David Hildenbrand
39b2e5cae4
selftests/vm: make MADV_POPULATE_(READ|WRITE) use in-tree headers
...
The madv_populate selftest currently builds with a warning when the
local installed headers (via the distribution) don't include
MADV_POPULATE_READ and MADV_POPULATE_WRITE. The warning is correct,
because the test cannot locate the necessary header.
The reason is that the in-tree installed headers (usr/include) have a
"linux" instead of a "sys" subdirectory.
Including "linux/mman.h" instead of "sys/mman.h" doesn't work (e.g.,
mmap() and madvise() are not defined that way). The only thing that
seems to work is including "linux/mman.h" in addition to "sys/mman.h".
We can get rid of our availability check and simplify.
Link: https://lkml.kernel.org/r/20211015165758.41374-1-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com >
Reported-by: Shuah Khan <skhan@linuxfoundation.org >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-11-06 13:30:42 -07:00
David Hildenbrand
e5bfac53e3
selftests/vm: add test for MADV_POPULATE_(READ|WRITE)
...
Let's add a simple test for MADV_POPULATE_READ and MADV_POPULATE_WRITE,
verifying some error handling, that population works, and that softdirty
tracking works as expected. For now, limit the test to private anonymous
memory.
Link: https://lkml.kernel.org/r/20210419135443.12822-6-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com >
Cc: Arnd Bergmann <arnd@arndb.de >
Cc: Michal Hocko <mhocko@suse.com >
Cc: Oscar Salvador <osalvador@suse.de >
Cc: Matthew Wilcox (Oracle) <willy@infradead.org >
Cc: Andrea Arcangeli <aarcange@redhat.com >
Cc: Minchan Kim <minchan@kernel.org >
Cc: Jann Horn <jannh@google.com >
Cc: Jason Gunthorpe <jgg@ziepe.ca >
Cc: Dave Hansen <dave.hansen@intel.com >
Cc: Hugh Dickins <hughd@google.com >
Cc: Rik van Riel <riel@surriel.com >
Cc: Michael S. Tsirkin <mst@redhat.com >
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com >
Cc: Vlastimil Babka <vbabka@suse.cz >
Cc: Richard Henderson <rth@twiddle.net >
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru >
Cc: Matt Turner <mattst88@gmail.com >
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de >
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com >
Cc: Helge Deller <deller@gmx.de >
Cc: Chris Zankel <chris@zankel.net >
Cc: Max Filippov <jcmvbkbc@gmail.com >
Cc: Mike Kravetz <mike.kravetz@oracle.com >
Cc: Peter Xu <peterx@redhat.com >
Cc: Rolf Eike Beer <eike-kernel@sf-tec.de >
Cc: Shuah Khan <shuah@kernel.org >
Cc: Ram Pai <linuxram@us.ibm.com >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2021-06-30 20:47:31 -07:00