]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
mshv: Add refcount and locking to mem regions
authorStanislav Kinsburskii <skinsburskii@linux.microsoft.com>
Wed, 3 Dec 2025 21:41:02 +0000 (21:41 +0000)
committerWei Liu <wei.liu@kernel.org>
Fri, 5 Dec 2025 23:20:28 +0000 (23:20 +0000)
commitc39dda08286f4d5ce4d114f8d5dbfdb85effbd6a
tree859e2316c2d04fe0b5017481518e1f101dca584f
parentabceb4297bf88340ce06016895babe292510a262
mshv: Add refcount and locking to mem regions

Introduce kref-based reference counting and spinlock protection for
memory regions in Hyper-V partition management. This change improves
memory region lifecycle management and ensures thread-safe access to the
region list.

Previously, the regions list was protected by the partition mutex.
However, this approach is too heavy for frequent fault and invalidation
operations. Finer grained locking is now used to improve efficiency and
concurrency.

This is a precursor to supporting movable memory regions. Fault and
invalidation handling for movable regions will require safe traversal of
the region list and holding a region reference while performing
invalidation or fault operations.

Signed-off-by: Stanislav Kinsburskii <skinsburskii@linux.microsoft.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
drivers/hv/mshv_regions.c
drivers/hv/mshv_root.h
drivers/hv/mshv_root_main.c