From 30dcce2709cbcb173d77b54cf17ee119cb08a2eb Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Mon, 17 Aug 2020 17:14:56 +0000 Subject: [PATCH] Skip Linux madvise(MADV_DONTNEED) on unmanaged objects. vm_object_madvise() is a no-op for unmanaged objects, but we should also limit the scope of mappings on which pmap_remove() is called. In particular, with the WIP largepage shm objects patch the kernel must remove mappings of such objects along superpage boundaries, and without this check Linux madvise(MADV_DONTNEED) could violate that requirement. Reviewed by: alc, kib MFC with: r362631 Sponsored by: Juniper Networks, Klara Inc. Differential Revision: https://reviews.freebsd.org/D26084 --- sys/compat/linux/linux_mmap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/compat/linux/linux_mmap.c b/sys/compat/linux/linux_mmap.c index 969e49e327e..48088e8b552 100644 --- a/sys/compat/linux/linux_mmap.c +++ b/sys/compat/linux/linux_mmap.c @@ -282,6 +282,8 @@ linux_madvise_dontneed(struct thread *td, vm_offset_t start, vm_offset_t end) object = entry->object.vm_object; if (object == NULL) continue; + if ((object->flags & (OBJ_UNMANAGED | OBJ_FICTITIOUS)) != 0) + continue; pstart = OFF_TO_IDX(entry->offset); if (start > entry->start) {