On 1/26/22 18:58, Naoya Horiguchi wrote: > On Thu, Jan 13, 2022 at 10:03:06AM -0800, Mike Kravetz wrote: >> MADV_DONTNEED is currently disabled for hugetlb mappings. This >> certainly makes sense in shared file mappings as the pagecache maintains >> a reference to the page and it will never be freed. However, it could >> be useful to unmap and free pages in private mappings. >> >> The only thing preventing MADV_DONTNEED (and MADV_FREE) from working on >> hugetlb mappings is a check in can_madv_lru_vma(). To allow support for >> hugetlb mappings create and use a new routine madvise_dontneed_valid_vma() >> that will allow hugetlb mappings. >> >> Signed-off-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx> > > I briefly tested the patch and it seems that when calling madvise(MADV_DONTNEED) > with the range unaligned to hugepage size (like 4kB) triggered the following crash. > Could you double check around the address range issue? Thanks Naoya! My bad for not considering this and doing more testing. -- Mike Kravetz