Re: [PATCH v1 07/23] mm/balloon_compaction: use a device-independent balloon (list) lock
From: David Hildenbrand <hidden>
Date: 2025-10-22 08:42:23
Also in:
linux-doc, linux-mm, lkml, virtualization
On 21.10.25 22:52, Michael S. Tsirkin wrote:
On Tue, Oct 21, 2025 at 02:59:12PM +0200, David Hildenbrand wrote:quoted
In order to remove the dependency on the page lock for balloon pages, we need a lock that is independent of the page. It's crucial that we can handle the scenario where balloon deflation (clearing page->private) can race with page isolation (using page->private to obtain the balloon_dev_info where the lock currently resides). The current lock in balloon_dev_info is therefore not suitable. Fortunately, we never really have more than a single balloon device per VM, so we can just keep it simple and use a static lock to protect all balloon devices. Based on this change we will remove the dependency on the page lock next. Signed-off-by: David Hildenbrand <redacted> --- include/linux/balloon_compaction.h | 6 ++--- mm/balloon_compaction.c | 36 +++++++++++++++++------------- 2 files changed, 23 insertions(+), 19 deletions(-)diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h index 3109d3c43d306..e2d9eb40e1fbb 100644 --- a/include/linux/balloon_compaction.h +++ b/include/linux/balloon_compaction.h@@ -21,10 +21,10 @@ * i. Setting the PG_movable_ops flag and page->private with the following * lock order * +-page_lock(page); - * +--spin_lock_irq(&b_dev_info->pages_lock); + * +--spin_lock_irq(&balloon_pages_lock); * * ii. isolation or dequeueing procedure must remove the page from balloon - * device page list under b_dev_info->pages_lock. + * device page list under &balloon_pages_lockUsing &balloon_pages_lock with an & is kinda weird here.
Indeed, fixed, thanks! -- Cheers David / dhildenb