Re: [PATCH 3/4] mm: prevent KSM from completely breaking VMA merging

From: David Hildenbrand
Date: Mon May 19 2025 - 15:28:37 EST



So, assuming we could remove the VM_PFNMAP | VM_IO | VM_DONTEXPAND |
VM_MIXEDMAP constraint from vma_ksm_compatible(), could we simplify?

Well I question removing this constraint for above reasons.

At any rate, even if we _could_ this feels like a bigger change that we
should come later.

"bigger" -- it might just be removing these 4 flags from the check ;)

I'll dig a bit more.

Right, but doing so would be out of scope here don't you think?

I'm fine with moving forward with this here. Just thinking how we can make more VMA merging "easily" possible and avoid the KSM magic in the mmap handling code.

(that early ksm check handling is rather ugly)

Your patch promises "prevent KSM from completely breaking VMA merging", and I guess that's true: after this patch merging with at least anon and MAP_PRIVATE of shmem it's not broken anymore. :)

--
Cheers,

David / dhildenb