]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mm: ksm: refer to special VMAs via VM_SPECIAL in ksm_compatible()
authorLorenzo Stoakes <lorenzo.stoakes@oracle.com>
Thu, 29 May 2025 17:15:46 +0000 (18:15 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 10 Jul 2025 05:41:53 +0000 (22:41 -0700)
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 <lorenzo.stoakes@oracle.com>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Chengming Zhou <chengming.zhou@linux.dev>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Xu Xin <xu.xin16@zte.com.cn>
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Jan Kara <jack@suse.cz>
Cc: Jann Horn <jannh@google.com>
Cc: Stefan Roesch <shr@devkernel.io>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/ksm.c

index 08d486f188ff33041e7e650a9343a1d7c7332681..d0c763abd49929725a5100eb06db56a2a0c07529 100644 (file)
--- 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))