Re: [PATCH v4 07/11] KVM: guest_memfd: Add support for freezing mappings
Sean Christopherson <[email protected]>
| Newsgroups | org.kernel.vger.linux-doc,dev.linux.lists.kvmarm,org.infradead.lists.kexec,org.kernel.vger.kvm,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest,org.kvack.linux-mm |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Jul 28, 2026, Tarun Sahu wrote: > +/** > + * kvm_gmem_freeze - Freeze or unfreeze a guest_memfd inode mapping. > + * @inode: The guest_memfd inode. > + * @freeze: True to freeze, false to unfreeze. > + * > + * This API is used strictly during the live update / preservation transition > + * window to prevent host userspace and guest-side faults from making any > + * mapping modifications (such as fallocate or page fault allocation) > + * to the guest_memfd page cache. > + * > + * Synchronization Strategy (Sleepable RCU): > + * To avoid high-contention VFS locks (like inode_lock or > + * filemap_invalidate_lock) on the vCPU page fault hot paths, this subsystem > + * implements a lightweight, system-wide Sleepable RCU (SRCU) mechanism > + * (`kvm_gmem_freeze_srcu`): > + * > + * Global vs. Per-Inode SRCU > + * ====================== > + * A single system-wide global static `srcu_struct` is used instead of a > + * per-inode SRCU structure to completely prevent unprivileged users from > + * exhausting the host's per-CPU memory allocator. This argument doesn't hold up given that each kvm structure has two SRCU structs.