From: Lorenzo Stoakes Date: Thu, 29 May 2025 17:15:46 +0000 (+0100) Subject: mm: ksm: refer to special VMAs via VM_SPECIAL in ksm_compatible() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b914c47d46da2ac66425521d304cbc8729153556;p=thirdparty%2Fkernel%2Flinux.git mm: ksm: refer to special VMAs via VM_SPECIAL in ksm_compatible() There's no need to spell out all the special cases, also doing it this way makes it absolutely clear that we preclude unmergeable VMAs in general, and puts the other excluded flags in stark and clear contrast. Link: https://lkml.kernel.org/r/c8be5b055163b164c8824020164076ee3b9389bd.1748537921.git.lorenzo.stoakes@oracle.com Signed-off-by: Lorenzo Stoakes Acked-by: David Hildenbrand Reviewed-by: Chengming Zhou Reviewed-by: Vlastimil Babka Reviewed-by: Xu Xin Reviewed-by: Liam R. Howlett Cc: Al Viro Cc: Christian Brauner Cc: Jan Kara Cc: Jann Horn Cc: Stefan Roesch Signed-off-by: Andrew Morton --- diff --git a/mm/ksm.c b/mm/ksm.c index 08d486f188ff3..d0c763abd4992 100644 --- a/mm/ksm.c +++ b/mm/ksm.c @@ -679,9 +679,8 @@ static int break_ksm(struct vm_area_struct *vma, unsigned long addr, bool lock_v static bool ksm_compatible(const struct file *file, vm_flags_t vm_flags) { - if (vm_flags & (VM_SHARED | VM_MAYSHARE | VM_PFNMAP | - VM_IO | VM_DONTEXPAND | VM_HUGETLB | - VM_MIXEDMAP | VM_DROPPABLE)) + if (vm_flags & (VM_SHARED | VM_MAYSHARE | VM_SPECIAL | + VM_HUGETLB | VM_DROPPABLE)) return false; /* just ignore the advice */ if (file_is_dax(file))