Commit 634ba645 authored by Mike Kravetz's avatar Mike Kravetz Committed by Andrew Morton

selftests/vm: update hugetlb madvise

Commit 8ebe0a5e ("mm,madvise,hugetlb: fix unexpected data loss with
MADV_DONTNEED on hugetlbfs") changed how the passed length was interpreted
for hugetlb mappings.  It was changed from align up to align down.  The
hugetlb-madvise test explicitly tests this behavior.  Change test to
expect new behavior.

Link: https://lkml.kernel.org/r/20221104011632.357049-1-mike.kravetz@oracle.com
Link: https://lore.kernel.org/oe-lkp/202211040619.2ec447d7-oliver.sang@intel.comSigned-off-by: default avatarMike Kravetz <mike.kravetz@oracle.com>
Reported-by: default avatarkernel test robot <oliver.sang@intel.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Rik van Riel <riel@surriel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 65917b53
......@@ -195,7 +195,7 @@ int main(int argc, char **argv)
exit(1);
}
/* addr + length should be aligned up to huge page size */
/* addr + length should be aligned down to huge page size */
if (madvise(addr,
((NR_HUGE_PAGES - 1) * huge_page_size) + base_page_size,
MADV_DONTNEED)) {
......@@ -203,10 +203,11 @@ int main(int argc, char **argv)
exit(1);
}
/* should free all pages in mapping */
validate_free_pages(free_hugepages);
/* should free all but last page in mapping */
validate_free_pages(free_hugepages - 1);
(void)munmap(addr, NR_HUGE_PAGES * huge_page_size);
validate_free_pages(free_hugepages);
/*
* Test MADV_DONTNEED on anonymous private mapping
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment