* [PATCH v2 00/23] mm: balloon infrastructure cleanups
@ 2026-01-15 9:19 David Hildenbrand (Red Hat)
2026-01-15 9:19 ` [PATCH v2 01/23] vmw_balloon: adjust BALLOON_DEFLATE when deflating while migrating David Hildenbrand (Red Hat)
` (24 more replies)
0 siblings, 25 replies; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 9:19 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, David Hildenbrand (Red Hat),
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
I started with wanting to remove the dependency of the balloon
infrastructure on the page lock, but ended up performing various other
cleanups, some of which I had on my todo list for years.
This series heavily cleans up and simplifies our balloon infrastructure,
including our balloon page migration functionality.
With this series, we no longer make use of the page lock for PageOffline
pages as part of the balloon infrastructure (preparing for memdescs
where PageOffline pages won't have any such lock), and simplifies
migration handling such that refcounting can more easily be adjusted
later (long-term focus is for PageOffline pages to not have a refcount
either).
Plenty of related cleanups.
Heavily compile-tested and heavily runtime-tested with virtio-balloon.
PPC CMM and the VMware balloon are untested and I'd appreciate a helping
hand from people that have suitable environments.
Not CCing maintainers for the vmscan.c and migrate.c change as they
are rather trivial and I don't want to patchbomb them.
--
This is based on mm/mm-unstable.
v1 -> v2:
* Rebased to latest mm/mm-unstable without any conflicts
* Minor patch description/subject and comment fixups
* Retested
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: "Liam R. Howlett" <Liam.Howlett@oracle.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jerrin Shaji George <jerrin.shaji-george@broadcom.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: "Eugenio Pérez" <eperezma@redhat.com>
Cc: Zi Yan <ziy@nvidia.com>
David Hildenbrand (Red Hat) (23):
vmw_balloon: adjust BALLOON_DEFLATE when deflating while migrating
vmw_balloon: remove vmballoon_compaction_init()
powerpc/pseries/cmm: remove cmm_balloon_compaction_init()
mm/balloon_compaction: centralize basic page migration handling
mm/balloon_compaction: centralize adjust_managed_page_count() handling
vmw_balloon: stop using the balloon_dev_info lock
mm/balloon_compaction: use a device-independent balloon (list) lock
mm/balloon_compaction: remove dependency on page lock
mm/balloon_compaction: make balloon_mops static
mm/balloon_compaction: drop fs.h include from balloon_compaction.h
drivers/virtio/virtio_balloon: stop using balloon_page_push/pop()
mm/balloon_compaction: remove balloon_page_push/pop()
mm/balloon_compaction: fold balloon_mapping_gfp_mask() into
balloon_page_alloc()
mm/balloon_compaction: move internal helpers to balloon_compaction.c
mm/balloon_compaction: assert that the balloon_pages_lock is held
mm/balloon_compaction: mark remaining functions for having proper
kerneldoc
mm/balloon_compaction: remove "extern" from functions
mm/vmscan: drop inclusion of balloon_compaction.h
mm: rename balloon_compaction.(c|h) to balloon.(c|h)
mm/kconfig: make BALLOON_COMPACTION depend on MIGRATION
mm: rename CONFIG_BALLOON_COMPACTION to CONFIG_BALLOON_MIGRATION
mm: rename CONFIG_MEMORY_BALLOON -> CONFIG_BALLOON
MAINTAINERS: move memory balloon infrastructure to "MEMORY MANAGEMENT
- BALLOON"
.../admin-guide/mm/memory-hotplug.rst | 8 +-
Documentation/core-api/mm-api.rst | 2 +-
MAINTAINERS | 12 +-
arch/powerpc/platforms/pseries/Kconfig | 2 +-
arch/powerpc/platforms/pseries/cmm.c | 53 +----
drivers/misc/Kconfig | 2 +-
drivers/misc/vmw_balloon.c | 105 +++-------
drivers/virtio/Kconfig | 2 +-
drivers/virtio/virtio_balloon.c | 64 ++----
include/linux/balloon.h | 77 +++++++
include/linux/balloon_compaction.h | 160 ---------------
include/linux/vm_event_item.h | 8 +-
mm/Kconfig | 23 +--
mm/Makefile | 2 +-
mm/{balloon_compaction.c => balloon.c} | 194 +++++++++++++-----
mm/memory_hotplug.c | 4 +-
mm/migrate.c | 2 +-
mm/vmscan.c | 1 -
mm/vmstat.c | 8 +-
19 files changed, 314 insertions(+), 415 deletions(-)
create mode 100644 include/linux/balloon.h
delete mode 100644 include/linux/balloon_compaction.h
rename mm/{balloon_compaction.c => balloon.c} (59%)
base-commit: f8ed52ac0cfbddff992bb9600941bfe51e1e385a
--
2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 01/23] vmw_balloon: adjust BALLOON_DEFLATE when deflating while migrating
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
@ 2026-01-15 9:19 ` David Hildenbrand (Red Hat)
2026-01-15 9:56 ` Lorenzo Stoakes
2026-01-15 9:19 ` [PATCH v2 02/23] vmw_balloon: remove vmballoon_compaction_init() David Hildenbrand (Red Hat)
` (23 subsequent siblings)
24 siblings, 1 reply; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 9:19 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, David Hildenbrand (Red Hat),
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan, SeongJae Park
When we're effectively deflating the balloon while migrating a page
because inflating the new page failed, we're not adjusting
BALLOON_DEFLATE.
Let's do that. This is a preparation for factoring out this handling to
the core code, making it work in a similar way first.
As this (deflating while migrating because of inflation error) is a
corner case that I don't really expect to happen in practice
and the stats are not that crucial, this likely doesn't classify as a fix.
Reviewed-by: SeongJae Park <sj@kernel.org>
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
drivers/misc/vmw_balloon.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
index cc1d18b3df5ca..2cc34c4968fac 100644
--- a/drivers/misc/vmw_balloon.c
+++ b/drivers/misc/vmw_balloon.c
@@ -1818,6 +1818,8 @@ static int vmballoon_migratepage(struct balloon_dev_info *b_dev_info,
if (status == VMW_BALLOON_SUCCESS) {
balloon_page_insert(&b->b_dev_info, newpage);
__count_vm_event(BALLOON_MIGRATE);
+ } else {
+ __count_vm_event(BALLOON_DEFLATE);
}
/*
--
2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 02/23] vmw_balloon: remove vmballoon_compaction_init()
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
2026-01-15 9:19 ` [PATCH v2 01/23] vmw_balloon: adjust BALLOON_DEFLATE when deflating while migrating David Hildenbrand (Red Hat)
@ 2026-01-15 9:19 ` David Hildenbrand (Red Hat)
2026-01-15 11:20 ` Lorenzo Stoakes
2026-01-15 9:19 ` [PATCH v2 03/23] powerpc/pseries/cmm: remove cmm_balloon_compaction_init() David Hildenbrand (Red Hat)
` (22 subsequent siblings)
24 siblings, 1 reply; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 9:19 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, David Hildenbrand (Red Hat),
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
Now that there is not a lot of logic left, let's just inline setting up
the migration function and drop all these excessive comments that are
not really required (or true) anymore.
To avoid #ifdef in the caller we can instead use IS_ENABLED() and make
the compiler happy by only providing the function declaration.
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
drivers/misc/vmw_balloon.c | 30 +++++-------------------------
1 file changed, 5 insertions(+), 25 deletions(-)
diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
index 2cc34c4968fac..07e60a4b846aa 100644
--- a/drivers/misc/vmw_balloon.c
+++ b/drivers/misc/vmw_balloon.c
@@ -1833,27 +1833,10 @@ static int vmballoon_migratepage(struct balloon_dev_info *b_dev_info,
up_read(&b->conf_sem);
return ret;
}
-
-/**
- * vmballoon_compaction_init() - initialized compaction for the balloon.
- *
- * @b: pointer to the balloon.
- *
- * If during the initialization a failure occurred, this function does not
- * perform cleanup. The caller must call vmballoon_compaction_deinit() in this
- * case.
- *
- * Return: zero on success or error code on failure.
- */
-static __init void vmballoon_compaction_init(struct vmballoon *b)
-{
- b->b_dev_info.migratepage = vmballoon_migratepage;
-}
-
#else /* CONFIG_BALLOON_COMPACTION */
-static inline void vmballoon_compaction_init(struct vmballoon *b)
-{
-}
+int vmballoon_migratepage(struct balloon_dev_info *b_dev_info,
+ struct page *newpage, struct page *page,
+ enum migrate_mode mode);
#endif /* CONFIG_BALLOON_COMPACTION */
static int __init vmballoon_init(void)
@@ -1873,12 +1856,9 @@ static int __init vmballoon_init(void)
if (error)
return error;
- /*
- * Initialization of compaction must be done after the call to
- * balloon_devinfo_init() .
- */
balloon_devinfo_init(&balloon.b_dev_info);
- vmballoon_compaction_init(&balloon);
+ if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
+ balloon.b_dev_info.migratepage = vmballoon_migratepage;
INIT_LIST_HEAD(&balloon.huge_pages);
spin_lock_init(&balloon.comm_lock);
--
2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 03/23] powerpc/pseries/cmm: remove cmm_balloon_compaction_init()
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
2026-01-15 9:19 ` [PATCH v2 01/23] vmw_balloon: adjust BALLOON_DEFLATE when deflating while migrating David Hildenbrand (Red Hat)
2026-01-15 9:19 ` [PATCH v2 02/23] vmw_balloon: remove vmballoon_compaction_init() David Hildenbrand (Red Hat)
@ 2026-01-15 9:19 ` David Hildenbrand (Red Hat)
2026-01-15 11:46 ` Lorenzo Stoakes
2026-01-15 9:19 ` [PATCH v2 04/23] mm/balloon_compaction: centralize basic page migration handling David Hildenbrand (Red Hat)
` (21 subsequent siblings)
24 siblings, 1 reply; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 9:19 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, David Hildenbrand (Red Hat),
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
Now that there is not a lot of logic left, let's just inline setting up
the migration function.
To avoid #ifdef in the caller we can instead use IS_ENABLED() and make
the compiler happy by only providing the function declaration.
Now that the function is gone, drop the "out_balloon_compaction" label.
Note that before commit 68f2736a8583 ("mm: Convert all PageMovable users
to movable_operations") we actually had to undo something, now not anymore.
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
arch/powerpc/platforms/pseries/cmm.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
index 4cbbe2ee58aba..9a6efbc80d2ad 100644
--- a/arch/powerpc/platforms/pseries/cmm.c
+++ b/arch/powerpc/platforms/pseries/cmm.c
@@ -548,15 +548,9 @@ static int cmm_migratepage(struct balloon_dev_info *b_dev_info,
return 0;
}
-
-static void cmm_balloon_compaction_init(void)
-{
- b_dev_info.migratepage = cmm_migratepage;
-}
#else /* CONFIG_BALLOON_COMPACTION */
-static void cmm_balloon_compaction_init(void)
-{
-}
+int cmm_migratepage(struct balloon_dev_info *b_dev_info, struct page *newpage,
+ struct page *page, enum migrate_mode mode);
#endif /* CONFIG_BALLOON_COMPACTION */
/**
@@ -573,11 +567,12 @@ static int cmm_init(void)
return -EOPNOTSUPP;
balloon_devinfo_init(&b_dev_info);
- cmm_balloon_compaction_init();
+ if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
+ b_dev_info.migratepage = cmm_migratepage;
rc = register_oom_notifier(&cmm_oom_nb);
if (rc < 0)
- goto out_balloon_compaction;
+ return rc;
if ((rc = register_reboot_notifier(&cmm_reboot_nb)))
goto out_oom_notifier;
@@ -606,7 +601,6 @@ static int cmm_init(void)
unregister_reboot_notifier(&cmm_reboot_nb);
out_oom_notifier:
unregister_oom_notifier(&cmm_oom_nb);
-out_balloon_compaction:
return rc;
}
--
2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 04/23] mm/balloon_compaction: centralize basic page migration handling
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
` (2 preceding siblings ...)
2026-01-15 9:19 ` [PATCH v2 03/23] powerpc/pseries/cmm: remove cmm_balloon_compaction_init() David Hildenbrand (Red Hat)
@ 2026-01-15 9:19 ` David Hildenbrand (Red Hat)
2026-01-15 12:18 ` Lorenzo Stoakes
2026-01-19 22:22 ` David Hildenbrand (Red Hat)
2026-01-15 9:19 ` [PATCH v2 05/23] mm/balloon_compaction: centralize adjust_managed_page_count() handling David Hildenbrand (Red Hat)
` (20 subsequent siblings)
24 siblings, 2 replies; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 9:19 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, David Hildenbrand (Red Hat),
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
Let's update the balloon page references, the balloon page list, the
BALLOON_MIGRATE counter and the isolated-pages counter in
balloon_page_migrate(), after letting the balloon->migratepage()
callback deal with the actual inflation+deflation.
Note that we now perform the balloon list modifications outside of any
implementation-specific locks: which is fine, there is nothing special
about these page actions that the lock would be protecting.
The old page is already no longer in the list (isolated) and the new page
is not yet in the list.
Let's use -ENOENT to communicate the special "inflation of new page
failed after already deflating the old page" to balloon_page_migrate() so
it can handle it accordingly.
While at it, rename balloon->b_dev_info to make it match the other
functions. Also, drop the comment above balloon_page_migrate(), which
seems unnecessary.
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
arch/powerpc/platforms/pseries/cmm.c | 16 ---------
drivers/misc/vmw_balloon.c | 49 +++++-----------------------
drivers/virtio/virtio_balloon.c | 12 -------
mm/balloon_compaction.c | 37 ++++++++++++++++++---
4 files changed, 41 insertions(+), 73 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
index 9a6efbc80d2ad..15f873f733a41 100644
--- a/arch/powerpc/platforms/pseries/cmm.c
+++ b/arch/powerpc/platforms/pseries/cmm.c
@@ -501,8 +501,6 @@ static int cmm_migratepage(struct balloon_dev_info *b_dev_info,
struct page *newpage, struct page *page,
enum migrate_mode mode)
{
- unsigned long flags;
-
/*
* loan/"inflate" the newpage first.
*
@@ -517,9 +515,6 @@ static int cmm_migratepage(struct balloon_dev_info *b_dev_info,
return -EBUSY;
}
- /* balloon page list reference */
- get_page(newpage);
-
/*
* When we migrate a page to a different zone, we have to fixup the
* count of both involved zones as we adjusted the managed page count
@@ -530,22 +525,11 @@ static int cmm_migratepage(struct balloon_dev_info *b_dev_info,
adjust_managed_page_count(newpage, -1);
}
- spin_lock_irqsave(&b_dev_info->pages_lock, flags);
- balloon_page_insert(b_dev_info, newpage);
- __count_vm_event(BALLOON_MIGRATE);
- b_dev_info->isolated_pages--;
- spin_unlock_irqrestore(&b_dev_info->pages_lock, flags);
-
/*
* activate/"deflate" the old page. We ignore any errors just like the
* other callers.
*/
plpar_page_set_active(page);
-
- balloon_page_finalize(page);
- /* balloon page list reference */
- put_page(page);
-
return 0;
}
#else /* CONFIG_BALLOON_COMPACTION */
diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
index 07e60a4b846aa..52b8c0f1eead7 100644
--- a/drivers/misc/vmw_balloon.c
+++ b/drivers/misc/vmw_balloon.c
@@ -1724,18 +1724,17 @@ static inline void vmballoon_debugfs_exit(struct vmballoon *b)
* @page: a ballooned page that should be migrated.
* @mode: migration mode, ignored.
*
- * This function is really open-coded, but that is according to the interface
- * that balloon_compaction provides.
- *
* Return: zero on success, -EAGAIN when migration cannot be performed
- * momentarily, and -EBUSY if migration failed and should be retried
- * with that specific page.
+ * momentarily, -EBUSY if migration failed and should be retried
+ * with that specific page, and -ENOENT when deflating @page
+ * succeeded but inflating @newpage failed, effectively deflating
+ * the balloon.
*/
static int vmballoon_migratepage(struct balloon_dev_info *b_dev_info,
struct page *newpage, struct page *page,
enum migrate_mode mode)
{
- unsigned long status, flags;
+ unsigned long status;
struct vmballoon *b;
int ret = 0;
@@ -1773,14 +1772,6 @@ static int vmballoon_migratepage(struct balloon_dev_info *b_dev_info,
goto out_unlock;
}
- /*
- * The page is isolated, so it is safe to delete it without holding
- * @pages_lock . We keep holding @comm_lock since we will need it in a
- * second.
- */
- balloon_page_finalize(page);
- put_page(page);
-
/* Inflate */
vmballoon_add_page(b, 0, newpage);
status = vmballoon_lock_op(b, 1, VMW_BALLOON_4K_PAGE,
@@ -1799,36 +1790,12 @@ static int vmballoon_migratepage(struct balloon_dev_info *b_dev_info,
* change.
*/
atomic64_dec(&b->size);
- } else {
/*
- * Success. Take a reference for the page, and we will add it to
- * the list after acquiring the lock.
+ * Tell the core that we're deflating the old page and don't
+ * need the new page.
*/
- get_page(newpage);
- }
-
- /* Update the balloon list under the @pages_lock */
- spin_lock_irqsave(&b->b_dev_info.pages_lock, flags);
-
- /*
- * On inflation success, we already took a reference for the @newpage.
- * If we succeed just insert it to the list and update the statistics
- * under the lock.
- */
- if (status == VMW_BALLOON_SUCCESS) {
- balloon_page_insert(&b->b_dev_info, newpage);
- __count_vm_event(BALLOON_MIGRATE);
- } else {
- __count_vm_event(BALLOON_DEFLATE);
+ ret = -ENOENT;
}
-
- /*
- * We deflated successfully, so regardless to the inflation success, we
- * need to reduce the number of isolated_pages.
- */
- b->b_dev_info.isolated_pages--;
- spin_unlock_irqrestore(&b->b_dev_info.pages_lock, flags);
-
out_unlock:
up_read(&b->conf_sem);
return ret;
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 74fe59f5a78c6..df2756c071dae 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -827,7 +827,6 @@ static int virtballoon_migratepage(struct balloon_dev_info *vb_dev_info,
{
struct virtio_balloon *vb = container_of(vb_dev_info,
struct virtio_balloon, vb_dev_info);
- unsigned long flags;
/*
* In order to avoid lock contention while migrating pages concurrently
@@ -840,8 +839,6 @@ static int virtballoon_migratepage(struct balloon_dev_info *vb_dev_info,
if (!mutex_trylock(&vb->balloon_lock))
return -EAGAIN;
- get_page(newpage); /* balloon reference */
-
/*
* When we migrate a page to a different zone and adjusted the
* managed page count when inflating, we have to fixup the count of
@@ -854,11 +851,6 @@ static int virtballoon_migratepage(struct balloon_dev_info *vb_dev_info,
}
/* balloon's page migration 1st step -- inflate "newpage" */
- spin_lock_irqsave(&vb_dev_info->pages_lock, flags);
- balloon_page_insert(vb_dev_info, newpage);
- vb_dev_info->isolated_pages--;
- __count_vm_event(BALLOON_MIGRATE);
- spin_unlock_irqrestore(&vb_dev_info->pages_lock, flags);
vb->num_pfns = VIRTIO_BALLOON_PAGES_PER_PAGE;
set_page_pfns(vb, vb->pfns, newpage);
tell_host(vb, vb->inflate_vq);
@@ -869,10 +861,6 @@ static int virtballoon_migratepage(struct balloon_dev_info *vb_dev_info,
tell_host(vb, vb->deflate_vq);
mutex_unlock(&vb->balloon_lock);
-
- balloon_page_finalize(page);
- put_page(page); /* balloon reference */
-
return 0;
}
#endif /* CONFIG_BALLOON_COMPACTION */
diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c
index 03c5dbabb1565..5444c61bb9e76 100644
--- a/mm/balloon_compaction.c
+++ b/mm/balloon_compaction.c
@@ -232,20 +232,49 @@ static void balloon_page_putback(struct page *page)
spin_unlock_irqrestore(&b_dev_info->pages_lock, flags);
}
-/* move_to_new_page() counterpart for a ballooned page */
static int balloon_page_migrate(struct page *newpage, struct page *page,
enum migrate_mode mode)
{
- struct balloon_dev_info *balloon = balloon_page_device(page);
+ struct balloon_dev_info *b_dev_info = balloon_page_device(page);
+ unsigned long flags;
+ int rc;
VM_BUG_ON_PAGE(!PageLocked(page), page);
VM_BUG_ON_PAGE(!PageLocked(newpage), newpage);
/* Isolated balloon pages cannot get deflated. */
- if (WARN_ON_ONCE(!balloon))
+ if (WARN_ON_ONCE(!b_dev_info))
return -EAGAIN;
- return balloon->migratepage(balloon, newpage, page, mode);
+ rc = b_dev_info->migratepage(b_dev_info, newpage, page, mode);
+ switch (rc) {
+ case 0:
+ spin_lock_irqsave(&b_dev_info->pages_lock, flags);
+
+ /* Insert the new page into the balloon list. */
+ get_page(newpage);
+
+ balloon_page_insert(b_dev_info, newpage);
+ __count_vm_event(BALLOON_MIGRATE);
+ break;
+ case -ENOENT:
+ spin_lock_irqsave(&b_dev_info->pages_lock, flags);
+
+ /* Old page was deflated but new page not inflated. */
+ __count_vm_event(BALLOON_DEFLATE);
+ break;
+ default:
+ return rc;
+ }
+
+ b_dev_info->isolated_pages--;
+ spin_unlock_irqrestore(&b_dev_info->pages_lock, flags);
+
+ /* Free the now-deflated page we isolated in balloon_page_isolate(). */
+ balloon_page_finalize(page);
+ put_page(page);
+
+ return 0;
}
const struct movable_operations balloon_mops = {
--
2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 05/23] mm/balloon_compaction: centralize adjust_managed_page_count() handling
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
` (3 preceding siblings ...)
2026-01-15 9:19 ` [PATCH v2 04/23] mm/balloon_compaction: centralize basic page migration handling David Hildenbrand (Red Hat)
@ 2026-01-15 9:19 ` David Hildenbrand (Red Hat)
2026-01-15 14:06 ` Liam R. Howlett
2026-01-15 9:19 ` [PATCH v2 06/23] vmw_balloon: stop using the balloon_dev_info lock David Hildenbrand (Red Hat)
` (19 subsequent siblings)
24 siblings, 1 reply; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 9:19 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, David Hildenbrand (Red Hat),
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
Let's centralize it, by allowing for the driver to enable this handling
through a new flag (bool for now) in the balloon device info.
Note that we now adjust the counter when adding/removing a page into the
balloon list: when removing a page to deflate it, it will now happen
before the driver communicated with hypervisor, not afterwards.
This shouldn't make a difference in practice.
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
arch/powerpc/platforms/pseries/cmm.c | 13 +------------
drivers/virtio/virtio_balloon.c | 19 ++-----------------
include/linux/balloon_compaction.h | 2 ++
mm/balloon_compaction.c | 17 +++++++++++++++++
4 files changed, 22 insertions(+), 29 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
index 15f873f733a41..7fd8b3d7e7637 100644
--- a/arch/powerpc/platforms/pseries/cmm.c
+++ b/arch/powerpc/platforms/pseries/cmm.c
@@ -165,7 +165,6 @@ static long cmm_alloc_pages(long nr)
balloon_page_enqueue(&b_dev_info, page);
atomic_long_inc(&loaned_pages);
- adjust_managed_page_count(page, -1);
nr--;
}
@@ -190,7 +189,6 @@ static long cmm_free_pages(long nr)
if (!page)
break;
plpar_page_set_active(page);
- adjust_managed_page_count(page, 1);
__free_page(page);
atomic_long_dec(&loaned_pages);
nr--;
@@ -515,16 +513,6 @@ static int cmm_migratepage(struct balloon_dev_info *b_dev_info,
return -EBUSY;
}
- /*
- * When we migrate a page to a different zone, we have to fixup the
- * count of both involved zones as we adjusted the managed page count
- * when inflating.
- */
- if (page_zone(page) != page_zone(newpage)) {
- adjust_managed_page_count(page, 1);
- adjust_managed_page_count(newpage, -1);
- }
-
/*
* activate/"deflate" the old page. We ignore any errors just like the
* other callers.
@@ -551,6 +539,7 @@ static int cmm_init(void)
return -EOPNOTSUPP;
balloon_devinfo_init(&b_dev_info);
+ b_dev_info.adjust_managed_page_count = true;
if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
b_dev_info.migratepage = cmm_migratepage;
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index df2756c071dae..15c1cf5fd249c 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -274,9 +274,6 @@ static unsigned int fill_balloon(struct virtio_balloon *vb, size_t num)
set_page_pfns(vb, vb->pfns + vb->num_pfns, page);
vb->num_pages += VIRTIO_BALLOON_PAGES_PER_PAGE;
- if (!virtio_has_feature(vb->vdev,
- VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
- adjust_managed_page_count(page, -1);
vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE;
}
@@ -295,9 +292,6 @@ static void release_pages_balloon(struct virtio_balloon *vb,
struct page *page, *next;
list_for_each_entry_safe(page, next, pages, lru) {
- if (!virtio_has_feature(vb->vdev,
- VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
- adjust_managed_page_count(page, 1);
list_del(&page->lru);
put_page(page); /* balloon reference */
}
@@ -839,17 +833,6 @@ static int virtballoon_migratepage(struct balloon_dev_info *vb_dev_info,
if (!mutex_trylock(&vb->balloon_lock))
return -EAGAIN;
- /*
- * When we migrate a page to a different zone and adjusted the
- * managed page count when inflating, we have to fixup the count of
- * both involved zones.
- */
- if (!virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM) &&
- page_zone(page) != page_zone(newpage)) {
- adjust_managed_page_count(page, 1);
- adjust_managed_page_count(newpage, -1);
- }
-
/* balloon's page migration 1st step -- inflate "newpage" */
vb->num_pfns = VIRTIO_BALLOON_PAGES_PER_PAGE;
set_page_pfns(vb, vb->pfns, newpage);
@@ -958,6 +941,8 @@ static int virtballoon_probe(struct virtio_device *vdev)
if (err)
goto out_free_vb;
+ if (!virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
+ vb->vb_dev_info.adjust_managed_page_count = true;
#ifdef CONFIG_BALLOON_COMPACTION
vb->vb_dev_info.migratepage = virtballoon_migratepage;
#endif
diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
index 7cfe48769239e..3109d3c43d306 100644
--- a/include/linux/balloon_compaction.h
+++ b/include/linux/balloon_compaction.h
@@ -56,6 +56,7 @@ struct balloon_dev_info {
struct list_head pages; /* Pages enqueued & handled to Host */
int (*migratepage)(struct balloon_dev_info *, struct page *newpage,
struct page *page, enum migrate_mode mode);
+ bool adjust_managed_page_count;
};
extern struct page *balloon_page_alloc(void);
@@ -73,6 +74,7 @@ static inline void balloon_devinfo_init(struct balloon_dev_info *balloon)
spin_lock_init(&balloon->pages_lock);
INIT_LIST_HEAD(&balloon->pages);
balloon->migratepage = NULL;
+ balloon->adjust_managed_page_count = false;
}
#ifdef CONFIG_BALLOON_COMPACTION
diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c
index 5444c61bb9e76..fd9ec47cf4670 100644
--- a/mm/balloon_compaction.c
+++ b/mm/balloon_compaction.c
@@ -23,6 +23,8 @@ static void balloon_page_enqueue_one(struct balloon_dev_info *b_dev_info,
BUG_ON(!trylock_page(page));
balloon_page_insert(b_dev_info, page);
unlock_page(page);
+ if (b_dev_info->adjust_managed_page_count)
+ adjust_managed_page_count(page, -1);
__count_vm_event(BALLOON_INFLATE);
inc_node_page_state(page, NR_BALLOON_PAGES);
}
@@ -95,6 +97,8 @@ size_t balloon_page_list_dequeue(struct balloon_dev_info *b_dev_info,
continue;
list_del(&page->lru);
+ if (b_dev_info->adjust_managed_page_count)
+ adjust_managed_page_count(page, 1);
balloon_page_finalize(page);
__count_vm_event(BALLOON_DEFLATE);
list_add(&page->lru, pages);
@@ -256,12 +260,25 @@ static int balloon_page_migrate(struct page *newpage, struct page *page,
balloon_page_insert(b_dev_info, newpage);
__count_vm_event(BALLOON_MIGRATE);
+
+ if (b_dev_info->adjust_managed_page_count &&
+ page_zone(page) != page_zone(newpage)) {
+ /*
+ * When we migrate a page to a different zone we
+ * have to fixup the count of both involved zones.
+ */
+ adjust_managed_page_count(page, 1);
+ adjust_managed_page_count(newpage, -1);
+ }
break;
case -ENOENT:
spin_lock_irqsave(&b_dev_info->pages_lock, flags);
/* Old page was deflated but new page not inflated. */
__count_vm_event(BALLOON_DEFLATE);
+
+ if (b_dev_info->adjust_managed_page_count)
+ adjust_managed_page_count(page, 1);
break;
default:
return rc;
--
2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 06/23] vmw_balloon: stop using the balloon_dev_info lock
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
` (4 preceding siblings ...)
2026-01-15 9:19 ` [PATCH v2 05/23] mm/balloon_compaction: centralize adjust_managed_page_count() handling David Hildenbrand (Red Hat)
@ 2026-01-15 9:19 ` David Hildenbrand (Red Hat)
2026-01-15 12:21 ` Lorenzo Stoakes
2026-01-15 9:19 ` [PATCH v2 07/23] mm/balloon_compaction: use a device-independent balloon (list) lock David Hildenbrand (Red Hat)
` (18 subsequent siblings)
24 siblings, 1 reply; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 9:19 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, David Hildenbrand (Red Hat),
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
Let's not piggy-back on the existing lock and use a separate lock for the
huge page list. Now that we use a separate lock, there is no need to
disable interrupts, so use the non-irqsave variants.
This is a preparation for changing the locking used to protect
balloon_dev_info.
While at it, talk about "page migration" instead of "page compaction".
We'll change that in core code soon as well.
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
drivers/misc/vmw_balloon.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
index 52b8c0f1eead7..53e9335b6718c 100644
--- a/drivers/misc/vmw_balloon.c
+++ b/drivers/misc/vmw_balloon.c
@@ -354,10 +354,15 @@ struct vmballoon {
/**
* @huge_pages - list of the inflated 2MB pages.
*
- * Protected by @b_dev_info.pages_lock .
+ * Protected by @huge_pages_lock.
*/
struct list_head huge_pages;
+ /**
+ * @huge_pages_lock: lock for the list of inflated 2MB pages.
+ */
+ spinlock_t huge_pages_lock;
+
/**
* @vmci_doorbell.
*
@@ -987,7 +992,6 @@ static void vmballoon_enqueue_page_list(struct vmballoon *b,
unsigned int *n_pages,
enum vmballoon_page_size_type page_size)
{
- unsigned long flags;
struct page *page;
if (page_size == VMW_BALLOON_4K_PAGE) {
@@ -995,9 +999,9 @@ static void vmballoon_enqueue_page_list(struct vmballoon *b,
} else {
/*
* Keep the huge pages in a local list which is not available
- * for the balloon compaction mechanism.
+ * for the balloon page migration.
*/
- spin_lock_irqsave(&b->b_dev_info.pages_lock, flags);
+ spin_lock(&b->huge_pages_lock);
list_for_each_entry(page, pages, lru) {
vmballoon_mark_page_offline(page, VMW_BALLOON_2M_PAGE);
@@ -1006,7 +1010,7 @@ static void vmballoon_enqueue_page_list(struct vmballoon *b,
list_splice_init(pages, &b->huge_pages);
__count_vm_events(BALLOON_INFLATE, *n_pages *
vmballoon_page_in_frames(VMW_BALLOON_2M_PAGE));
- spin_unlock_irqrestore(&b->b_dev_info.pages_lock, flags);
+ spin_unlock(&b->huge_pages_lock);
}
*n_pages = 0;
@@ -1033,7 +1037,6 @@ static void vmballoon_dequeue_page_list(struct vmballoon *b,
{
struct page *page, *tmp;
unsigned int i = 0;
- unsigned long flags;
/* In the case of 4k pages, use the compaction infrastructure */
if (page_size == VMW_BALLOON_4K_PAGE) {
@@ -1043,7 +1046,7 @@ static void vmballoon_dequeue_page_list(struct vmballoon *b,
}
/* 2MB pages */
- spin_lock_irqsave(&b->b_dev_info.pages_lock, flags);
+ spin_lock(&b->huge_pages_lock);
list_for_each_entry_safe(page, tmp, &b->huge_pages, lru) {
vmballoon_mark_page_online(page, VMW_BALLOON_2M_PAGE);
@@ -1054,7 +1057,7 @@ static void vmballoon_dequeue_page_list(struct vmballoon *b,
__count_vm_events(BALLOON_DEFLATE,
i * vmballoon_page_in_frames(VMW_BALLOON_2M_PAGE));
- spin_unlock_irqrestore(&b->b_dev_info.pages_lock, flags);
+ spin_unlock(&b->huge_pages_lock);
*n_pages = i;
}
@@ -1828,6 +1831,7 @@ static int __init vmballoon_init(void)
balloon.b_dev_info.migratepage = vmballoon_migratepage;
INIT_LIST_HEAD(&balloon.huge_pages);
+ spin_lock_init(&balloon.huge_pages_lock);
spin_lock_init(&balloon.comm_lock);
init_rwsem(&balloon.conf_sem);
balloon.vmci_doorbell = VMCI_INVALID_HANDLE;
--
2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 07/23] mm/balloon_compaction: use a device-independent balloon (list) lock
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
` (5 preceding siblings ...)
2026-01-15 9:19 ` [PATCH v2 06/23] vmw_balloon: stop using the balloon_dev_info lock David Hildenbrand (Red Hat)
@ 2026-01-15 9:19 ` David Hildenbrand (Red Hat)
2026-01-15 9:19 ` [PATCH v2 08/23] mm/balloon_compaction: remove dependency on page lock David Hildenbrand (Red Hat)
` (17 subsequent siblings)
24 siblings, 0 replies; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 9:19 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, David Hildenbrand (Red Hat),
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
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 (Red Hat) <david@kernel.org>
---
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..9a8568fcd477d 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_lock
*
* The functions provided by this interface are placed to help on coping with
* the aforementioned balloon page corner case, as well as to ensure the simple
@@ -52,7 +52,6 @@
*/
struct balloon_dev_info {
unsigned long isolated_pages; /* # of isolated pages for migration */
- spinlock_t pages_lock; /* Protection to pages list */
struct list_head pages; /* Pages enqueued & handled to Host */
int (*migratepage)(struct balloon_dev_info *, struct page *newpage,
struct page *page, enum migrate_mode mode);
@@ -71,7 +70,6 @@ extern size_t balloon_page_list_dequeue(struct balloon_dev_info *b_dev_info,
static inline void balloon_devinfo_init(struct balloon_dev_info *balloon)
{
balloon->isolated_pages = 0;
- spin_lock_init(&balloon->pages_lock);
INIT_LIST_HEAD(&balloon->pages);
balloon->migratepage = NULL;
balloon->adjust_managed_page_count = false;
diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c
index fd9ec47cf4670..97e838795354d 100644
--- a/mm/balloon_compaction.c
+++ b/mm/balloon_compaction.c
@@ -11,6 +11,12 @@
#include <linux/export.h>
#include <linux/balloon_compaction.h>
+/*
+ * Lock protecting the balloon_dev_info of all devices. We don't really
+ * expect more than one device.
+ */
+static DEFINE_SPINLOCK(balloon_pages_lock);
+
static void balloon_page_enqueue_one(struct balloon_dev_info *b_dev_info,
struct page *page)
{
@@ -47,13 +53,13 @@ size_t balloon_page_list_enqueue(struct balloon_dev_info *b_dev_info,
unsigned long flags;
size_t n_pages = 0;
- spin_lock_irqsave(&b_dev_info->pages_lock, flags);
+ spin_lock_irqsave(&balloon_pages_lock, flags);
list_for_each_entry_safe(page, tmp, pages, lru) {
list_del(&page->lru);
balloon_page_enqueue_one(b_dev_info, page);
n_pages++;
}
- spin_unlock_irqrestore(&b_dev_info->pages_lock, flags);
+ spin_unlock_irqrestore(&balloon_pages_lock, flags);
return n_pages;
}
EXPORT_SYMBOL_GPL(balloon_page_list_enqueue);
@@ -83,7 +89,7 @@ size_t balloon_page_list_dequeue(struct balloon_dev_info *b_dev_info,
unsigned long flags;
size_t n_pages = 0;
- spin_lock_irqsave(&b_dev_info->pages_lock, flags);
+ spin_lock_irqsave(&balloon_pages_lock, flags);
list_for_each_entry_safe(page, tmp, &b_dev_info->pages, lru) {
if (n_pages == n_req_pages)
break;
@@ -106,7 +112,7 @@ size_t balloon_page_list_dequeue(struct balloon_dev_info *b_dev_info,
dec_node_page_state(page, NR_BALLOON_PAGES);
n_pages++;
}
- spin_unlock_irqrestore(&b_dev_info->pages_lock, flags);
+ spin_unlock_irqrestore(&balloon_pages_lock, flags);
return n_pages;
}
@@ -149,9 +155,9 @@ void balloon_page_enqueue(struct balloon_dev_info *b_dev_info,
{
unsigned long flags;
- spin_lock_irqsave(&b_dev_info->pages_lock, flags);
+ spin_lock_irqsave(&balloon_pages_lock, flags);
balloon_page_enqueue_one(b_dev_info, page);
- spin_unlock_irqrestore(&b_dev_info->pages_lock, flags);
+ spin_unlock_irqrestore(&balloon_pages_lock, flags);
}
EXPORT_SYMBOL_GPL(balloon_page_enqueue);
@@ -191,11 +197,11 @@ struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info)
* BUG() here, otherwise the balloon driver may get stuck in
* an infinite loop while attempting to release all its pages.
*/
- spin_lock_irqsave(&b_dev_info->pages_lock, flags);
+ spin_lock_irqsave(&balloon_pages_lock, flags);
if (unlikely(list_empty(&b_dev_info->pages) &&
!b_dev_info->isolated_pages))
BUG();
- spin_unlock_irqrestore(&b_dev_info->pages_lock, flags);
+ spin_unlock_irqrestore(&balloon_pages_lock, flags);
return NULL;
}
return list_first_entry(&pages, struct page, lru);
@@ -213,10 +219,10 @@ static bool balloon_page_isolate(struct page *page, isolate_mode_t mode)
if (!b_dev_info)
return false;
- spin_lock_irqsave(&b_dev_info->pages_lock, flags);
+ spin_lock_irqsave(&balloon_pages_lock, flags);
list_del(&page->lru);
b_dev_info->isolated_pages++;
- spin_unlock_irqrestore(&b_dev_info->pages_lock, flags);
+ spin_unlock_irqrestore(&balloon_pages_lock, flags);
return true;
}
@@ -230,10 +236,10 @@ static void balloon_page_putback(struct page *page)
if (WARN_ON_ONCE(!b_dev_info))
return;
- spin_lock_irqsave(&b_dev_info->pages_lock, flags);
+ spin_lock_irqsave(&balloon_pages_lock, flags);
list_add(&page->lru, &b_dev_info->pages);
b_dev_info->isolated_pages--;
- spin_unlock_irqrestore(&b_dev_info->pages_lock, flags);
+ spin_unlock_irqrestore(&balloon_pages_lock, flags);
}
static int balloon_page_migrate(struct page *newpage, struct page *page,
@@ -253,7 +259,7 @@ static int balloon_page_migrate(struct page *newpage, struct page *page,
rc = b_dev_info->migratepage(b_dev_info, newpage, page, mode);
switch (rc) {
case 0:
- spin_lock_irqsave(&b_dev_info->pages_lock, flags);
+ spin_lock_irqsave(&balloon_pages_lock, flags);
/* Insert the new page into the balloon list. */
get_page(newpage);
@@ -272,7 +278,7 @@ static int balloon_page_migrate(struct page *newpage, struct page *page,
}
break;
case -ENOENT:
- spin_lock_irqsave(&b_dev_info->pages_lock, flags);
+ spin_lock_irqsave(&balloon_pages_lock, flags);
/* Old page was deflated but new page not inflated. */
__count_vm_event(BALLOON_DEFLATE);
@@ -285,7 +291,7 @@ static int balloon_page_migrate(struct page *newpage, struct page *page,
}
b_dev_info->isolated_pages--;
- spin_unlock_irqrestore(&b_dev_info->pages_lock, flags);
+ spin_unlock_irqrestore(&balloon_pages_lock, flags);
/* Free the now-deflated page we isolated in balloon_page_isolate(). */
balloon_page_finalize(page);
--
2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 08/23] mm/balloon_compaction: remove dependency on page lock
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
` (6 preceding siblings ...)
2026-01-15 9:19 ` [PATCH v2 07/23] mm/balloon_compaction: use a device-independent balloon (list) lock David Hildenbrand (Red Hat)
@ 2026-01-15 9:19 ` David Hildenbrand (Red Hat)
2026-01-15 9:19 ` [PATCH v2 09/23] mm/balloon_compaction: make balloon_mops static David Hildenbrand (Red Hat)
` (16 subsequent siblings)
24 siblings, 0 replies; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 9:19 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, David Hildenbrand (Red Hat),
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
Let's stop using the page lock in balloon code and instead use only the
balloon_device_lock.
As soon as we set the PG_movable_ops flag, we might now get isolation
callbacks for that page as we are no longer holding the page lock. In
there, we'll simply synchronize using the balloon_device_lock.
So in balloon_page_isolate() lookup the balloon_dev_info through
page->private under balloon_device_lock.
It's crucial that we update page->private under the balloon_device_lock,
so the isolation callback can properly deal with concurrent deflation.
Consequently, make sure that balloon_page_finalize() is called under
balloon_device_lock as we remove a page from the list and clear
page->private. balloon_page_insert() is already called with the
balloon_device_lock held.
Note that the core will still lock the pages, for example in
isolate_movable_ops_page(). The lock is there still relevant for
handling the PageMovableOpsIsolated flag, but that can be later changed
to use an atomic test-and-set instead, or moved into the movable_ops
backends.
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
include/linux/balloon_compaction.h | 25 ++++++++++----------
mm/balloon_compaction.c | 38 ++++++++++--------------------
2 files changed, 25 insertions(+), 38 deletions(-)
diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
index 9a8568fcd477d..ad594af6ed100 100644
--- a/include/linux/balloon_compaction.h
+++ b/include/linux/balloon_compaction.h
@@ -12,25 +12,27 @@
* is derived from the page type (PageOffline()) combined with the
* PG_movable_ops flag (PageMovableOps()).
*
+ * Once the page type and the PG_movable_ops are set, migration code
+ * can initiate page isolation by invoking the
+ * movable_operations()->isolate_page() callback
+ *
+ * As long as page->private is set, the page is either on the balloon list
+ * or isolated for migration. If page->private is not set, the page is
+ * either still getting inflated, or was deflated to be freed by the balloon
+ * driver soon. Isolation is impossible in both cases.
+ *
* As the page isolation scanning step a compaction thread does is a lockless
* procedure (from a page standpoint), it might bring some racy situations while
* performing balloon page compaction. In order to sort out these racy scenarios
* and safely perform balloon's page compaction and migration we must, always,
* ensure following these simple rules:
*
- * i. Setting the PG_movable_ops flag and page->private with the following
- * lock order
- * +-page_lock(page);
- * +--spin_lock_irq(&balloon_pages_lock);
+ * i. Inflation/deflation must set/clear page->private under the
+ * balloon_pages_lock
*
* ii. isolation or dequeueing procedure must remove the page from balloon
* device page list under balloon_pages_lock
*
- * The functions provided by this interface are placed to help on coping with
- * the aforementioned balloon page corner case, as well as to ensure the simple
- * set of exposed rules are satisfied while we are dealing with balloon pages
- * compaction / migration.
- *
* Copyright (C) 2012, Red Hat, Inc. Rafael Aquini <aquini@redhat.com>
*/
#ifndef _LINUX_BALLOON_COMPACTION_H
@@ -93,8 +95,7 @@ static inline struct balloon_dev_info *balloon_page_device(struct page *page)
* @balloon : pointer to balloon device
* @page : page to be assigned as a 'balloon page'
*
- * Caller must ensure the page is locked and the spin_lock protecting balloon
- * pages list is held before inserting a page into the balloon device.
+ * Caller must ensure the balloon_pages_lock is held.
*/
static inline void balloon_page_insert(struct balloon_dev_info *balloon,
struct page *page)
@@ -119,7 +120,7 @@ static inline gfp_t balloon_mapping_gfp_mask(void)
* balloon list for release to the page allocator
* @page: page to be released to the page allocator
*
- * Caller must ensure that the page is locked.
+ * Caller must ensure the balloon_pages_lock is held.
*/
static inline void balloon_page_finalize(struct page *page)
{
diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c
index 97e838795354d..28ef0cb6b3bbc 100644
--- a/mm/balloon_compaction.c
+++ b/mm/balloon_compaction.c
@@ -20,15 +20,7 @@ static DEFINE_SPINLOCK(balloon_pages_lock);
static void balloon_page_enqueue_one(struct balloon_dev_info *b_dev_info,
struct page *page)
{
- /*
- * Block others from accessing the 'page' when we get around to
- * establishing additional references. We should be the only one
- * holding a reference to the 'page' at this point. If we are not, then
- * memory corruption is possible and we should stop execution.
- */
- BUG_ON(!trylock_page(page));
balloon_page_insert(b_dev_info, page);
- unlock_page(page);
if (b_dev_info->adjust_managed_page_count)
adjust_managed_page_count(page, -1);
__count_vm_event(BALLOON_INFLATE);
@@ -93,22 +85,12 @@ size_t balloon_page_list_dequeue(struct balloon_dev_info *b_dev_info,
list_for_each_entry_safe(page, tmp, &b_dev_info->pages, lru) {
if (n_pages == n_req_pages)
break;
-
- /*
- * Block others from accessing the 'page' while we get around to
- * establishing additional references and preparing the 'page'
- * to be released by the balloon driver.
- */
- if (!trylock_page(page))
- continue;
-
list_del(&page->lru);
if (b_dev_info->adjust_managed_page_count)
adjust_managed_page_count(page, 1);
balloon_page_finalize(page);
__count_vm_event(BALLOON_DEFLATE);
list_add(&page->lru, pages);
- unlock_page(page);
dec_node_page_state(page, NR_BALLOON_PAGES);
n_pages++;
}
@@ -213,13 +195,19 @@ EXPORT_SYMBOL_GPL(balloon_page_dequeue);
static bool balloon_page_isolate(struct page *page, isolate_mode_t mode)
{
- struct balloon_dev_info *b_dev_info = balloon_page_device(page);
+ struct balloon_dev_info *b_dev_info;
unsigned long flags;
- if (!b_dev_info)
- return false;
-
spin_lock_irqsave(&balloon_pages_lock, flags);
+ b_dev_info = balloon_page_device(page);
+ if (!b_dev_info) {
+ /*
+ * The page already got deflated and removed from the
+ * balloon list.
+ */
+ spin_unlock_irqrestore(&balloon_pages_lock, flags);
+ return false;
+ }
list_del(&page->lru);
b_dev_info->isolated_pages++;
spin_unlock_irqrestore(&balloon_pages_lock, flags);
@@ -249,9 +237,6 @@ static int balloon_page_migrate(struct page *newpage, struct page *page,
unsigned long flags;
int rc;
- VM_BUG_ON_PAGE(!PageLocked(page), page);
- VM_BUG_ON_PAGE(!PageLocked(newpage), newpage);
-
/* Isolated balloon pages cannot get deflated. */
if (WARN_ON_ONCE(!b_dev_info))
return -EAGAIN;
@@ -291,10 +276,11 @@ static int balloon_page_migrate(struct page *newpage, struct page *page,
}
b_dev_info->isolated_pages--;
- spin_unlock_irqrestore(&balloon_pages_lock, flags);
/* Free the now-deflated page we isolated in balloon_page_isolate(). */
balloon_page_finalize(page);
+ spin_unlock_irqrestore(&balloon_pages_lock, flags);
+
put_page(page);
return 0;
--
2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 09/23] mm/balloon_compaction: make balloon_mops static
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
` (7 preceding siblings ...)
2026-01-15 9:19 ` [PATCH v2 08/23] mm/balloon_compaction: remove dependency on page lock David Hildenbrand (Red Hat)
@ 2026-01-15 9:19 ` David Hildenbrand (Red Hat)
2026-01-15 12:22 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 10/23] mm/balloon_compaction: drop fs.h include from balloon_compaction.h David Hildenbrand (Red Hat)
` (15 subsequent siblings)
24 siblings, 1 reply; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 9:19 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, David Hildenbrand (Red Hat),
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
There is no need to expose this anymore, so let's just make it static.
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
include/linux/balloon_compaction.h | 1 -
mm/balloon_compaction.c | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
index ad594af6ed100..7db66c2c86cdc 100644
--- a/include/linux/balloon_compaction.h
+++ b/include/linux/balloon_compaction.h
@@ -78,7 +78,6 @@ static inline void balloon_devinfo_init(struct balloon_dev_info *balloon)
}
#ifdef CONFIG_BALLOON_COMPACTION
-extern const struct movable_operations balloon_mops;
/*
* balloon_page_device - get the b_dev_info descriptor for the balloon device
* that enqueues the given page.
diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c
index 28ef0cb6b3bbc..c44e0b62203cc 100644
--- a/mm/balloon_compaction.c
+++ b/mm/balloon_compaction.c
@@ -286,7 +286,7 @@ static int balloon_page_migrate(struct page *newpage, struct page *page,
return 0;
}
-const struct movable_operations balloon_mops = {
+static const struct movable_operations balloon_mops = {
.migrate_page = balloon_page_migrate,
.isolate_page = balloon_page_isolate,
.putback_page = balloon_page_putback,
--
2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 10/23] mm/balloon_compaction: drop fs.h include from balloon_compaction.h
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
` (8 preceding siblings ...)
2026-01-15 9:19 ` [PATCH v2 09/23] mm/balloon_compaction: make balloon_mops static David Hildenbrand (Red Hat)
@ 2026-01-15 9:20 ` David Hildenbrand (Red Hat)
2026-01-15 12:25 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 11/23] drivers/virtio/virtio_balloon: stop using balloon_page_push/pop() David Hildenbrand (Red Hat)
` (14 subsequent siblings)
24 siblings, 1 reply; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 9:20 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, David Hildenbrand (Red Hat),
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
Ever since commit 68f2736a8583 ("mm: Convert all PageMovable users to
movable_operations") we no longer store an inode in balloon_dev_info,
so we can stop including "fs.h".
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
include/linux/balloon_compaction.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
index 7db66c2c86cdc..1452ea0635245 100644
--- a/include/linux/balloon_compaction.h
+++ b/include/linux/balloon_compaction.h
@@ -42,7 +42,6 @@
#include <linux/migrate.h>
#include <linux/gfp.h>
#include <linux/err.h>
-#include <linux/fs.h>
#include <linux/list.h>
/*
--
2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 11/23] drivers/virtio/virtio_balloon: stop using balloon_page_push/pop()
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
` (9 preceding siblings ...)
2026-01-15 9:20 ` [PATCH v2 10/23] mm/balloon_compaction: drop fs.h include from balloon_compaction.h David Hildenbrand (Red Hat)
@ 2026-01-15 9:20 ` David Hildenbrand (Red Hat)
2026-01-15 12:28 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 12/23] mm/balloon_compaction: remove balloon_page_push/pop() David Hildenbrand (Red Hat)
` (13 subsequent siblings)
24 siblings, 1 reply; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 9:20 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, David Hildenbrand (Red Hat),
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
Let's stop using these functions so we can remove them. They look like
belonging to the balloon API for managing the device balloon list when
really they are just simple helpers only used by virtio-balloon.
Let's just inline them and switch to a proper
list_for_each_entry_safe().
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
drivers/virtio/virtio_balloon.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 15c1cf5fd249c..6ae00de78b61b 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -242,8 +242,8 @@ static void set_page_pfns(struct virtio_balloon *vb,
static unsigned int fill_balloon(struct virtio_balloon *vb, size_t num)
{
unsigned int num_allocated_pages;
+ struct page *page, *next;
unsigned int num_pfns;
- struct page *page;
LIST_HEAD(pages);
/* We can only do one array worth at a time. */
@@ -262,14 +262,15 @@ static unsigned int fill_balloon(struct virtio_balloon *vb, size_t num)
break;
}
- balloon_page_push(&pages, page);
+ list_add(&page->lru, &pages);
}
mutex_lock(&vb->balloon_lock);
vb->num_pfns = 0;
- while ((page = balloon_page_pop(&pages))) {
+ list_for_each_entry_safe(page, next, &pages, lru) {
+ list_del(&page->lru);
balloon_page_enqueue(&vb->vb_dev_info, page);
set_page_pfns(vb, vb->pfns + vb->num_pfns, page);
@@ -474,15 +475,19 @@ static inline s64 towards_target(struct virtio_balloon *vb)
static unsigned long return_free_pages_to_mm(struct virtio_balloon *vb,
unsigned long num_to_return)
{
- struct page *page;
- unsigned long num_returned;
+ unsigned long num_returned = 0;
+ struct page *page, *next;
+
+ if (unlikely(!num_to_return))
+ return 0;
spin_lock_irq(&vb->free_page_list_lock);
- for (num_returned = 0; num_returned < num_to_return; num_returned++) {
- page = balloon_page_pop(&vb->free_page_list);
- if (!page)
- break;
+
+ list_for_each_entry_safe(page, next, &vb->free_page_list, lru) {
+ list_del(&page->lru);
__free_pages(page, VIRTIO_BALLOON_HINT_BLOCK_ORDER);
+ if (++num_returned == num_to_return)
+ break;
}
vb->num_free_page_blocks -= num_returned;
spin_unlock_irq(&vb->free_page_list_lock);
@@ -717,7 +722,7 @@ static int get_free_page_and_send(struct virtio_balloon *vb)
}
virtqueue_kick(vq);
spin_lock_irq(&vb->free_page_list_lock);
- balloon_page_push(&vb->free_page_list, page);
+ list_add(&page->lru, &vb->free_page_list);
vb->num_free_page_blocks++;
spin_unlock_irq(&vb->free_page_list_lock);
} else {
--
2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 12/23] mm/balloon_compaction: remove balloon_page_push/pop()
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
` (10 preceding siblings ...)
2026-01-15 9:20 ` [PATCH v2 11/23] drivers/virtio/virtio_balloon: stop using balloon_page_push/pop() David Hildenbrand (Red Hat)
@ 2026-01-15 9:20 ` David Hildenbrand (Red Hat)
2026-01-15 12:29 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 13/23] mm/balloon_compaction: fold balloon_mapping_gfp_mask() into balloon_page_alloc() David Hildenbrand (Red Hat)
` (12 subsequent siblings)
24 siblings, 1 reply; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 9:20 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, David Hildenbrand (Red Hat),
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
Let's remove these helpers as they are unused now.
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
include/linux/balloon_compaction.h | 30 ------------------------------
mm/balloon_compaction.c | 5 ++---
2 files changed, 2 insertions(+), 33 deletions(-)
diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
index 1452ea0635245..e5451cf1f6589 100644
--- a/include/linux/balloon_compaction.h
+++ b/include/linux/balloon_compaction.h
@@ -126,34 +126,4 @@ static inline void balloon_page_finalize(struct page *page)
set_page_private(page, 0);
/* PageOffline is sticky until the page is freed to the buddy. */
}
-
-/*
- * balloon_page_push - insert a page into a page list.
- * @head : pointer to list
- * @page : page to be added
- *
- * Caller must ensure the page is private and protect the list.
- */
-static inline void balloon_page_push(struct list_head *pages, struct page *page)
-{
- list_add(&page->lru, pages);
-}
-
-/*
- * balloon_page_pop - remove a page from a page list.
- * @head : pointer to list
- * @page : page to be added
- *
- * Caller must ensure the page is private and protect the list.
- */
-static inline struct page *balloon_page_pop(struct list_head *pages)
-{
- struct page *page = list_first_entry_or_null(pages, struct page, lru);
-
- if (!page)
- return NULL;
-
- list_del(&page->lru);
- return page;
-}
#endif /* _LINUX_BALLOON_COMPACTION_H */
diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c
index c44e0b62203cc..90b2d61a593b7 100644
--- a/mm/balloon_compaction.c
+++ b/mm/balloon_compaction.c
@@ -128,9 +128,8 @@ EXPORT_SYMBOL_GPL(balloon_page_alloc);
* Drivers must call this function to properly enqueue a new allocated balloon
* page before definitively removing the page from the guest system.
*
- * Drivers must not call balloon_page_enqueue on pages that have been pushed to
- * a list with balloon_page_push before removing them with balloon_page_pop. To
- * enqueue a list of pages, use balloon_page_list_enqueue instead.
+ * Drivers must not enqueue pages while page->lru is still in
+ * use, and must not use page->lru until a page was unqueued again.
*/
void balloon_page_enqueue(struct balloon_dev_info *b_dev_info,
struct page *page)
--
2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 13/23] mm/balloon_compaction: fold balloon_mapping_gfp_mask() into balloon_page_alloc()
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
` (11 preceding siblings ...)
2026-01-15 9:20 ` [PATCH v2 12/23] mm/balloon_compaction: remove balloon_page_push/pop() David Hildenbrand (Red Hat)
@ 2026-01-15 9:20 ` David Hildenbrand (Red Hat)
2026-01-15 12:30 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 14/23] mm/balloon_compaction: move internal helpers to balloon_compaction.c David Hildenbrand (Red Hat)
` (11 subsequent siblings)
24 siblings, 1 reply; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 9:20 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, David Hildenbrand (Red Hat),
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
Let's just remove balloon_mapping_gfp_mask().
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
include/linux/balloon_compaction.h | 7 -------
mm/balloon_compaction.c | 12 ++++++++----
2 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
index e5451cf1f6589..d1d4739398978 100644
--- a/include/linux/balloon_compaction.h
+++ b/include/linux/balloon_compaction.h
@@ -106,13 +106,6 @@ static inline void balloon_page_insert(struct balloon_dev_info *balloon,
list_add(&page->lru, &balloon->pages);
}
-static inline gfp_t balloon_mapping_gfp_mask(void)
-{
- if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
- return GFP_HIGHUSER_MOVABLE;
- return GFP_HIGHUSER;
-}
-
/*
* balloon_page_finalize - prepare a balloon page that was removed from the
* balloon list for release to the page allocator
diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c
index 90b2d61a593b7..709c57c00b481 100644
--- a/mm/balloon_compaction.c
+++ b/mm/balloon_compaction.c
@@ -112,10 +112,14 @@ EXPORT_SYMBOL_GPL(balloon_page_list_dequeue);
*/
struct page *balloon_page_alloc(void)
{
- struct page *page = alloc_page(balloon_mapping_gfp_mask() |
- __GFP_NOMEMALLOC | __GFP_NORETRY |
- __GFP_NOWARN);
- return page;
+ gfp_t gfp_flags = __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN;
+
+ if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
+ gfp_flags |= GFP_HIGHUSER_MOVABLE;
+ else
+ gfp_flags |= GFP_HIGHUSER;
+
+ return alloc_page(gfp_flags);
}
EXPORT_SYMBOL_GPL(balloon_page_alloc);
--
2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 14/23] mm/balloon_compaction: move internal helpers to balloon_compaction.c
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
` (12 preceding siblings ...)
2026-01-15 9:20 ` [PATCH v2 13/23] mm/balloon_compaction: fold balloon_mapping_gfp_mask() into balloon_page_alloc() David Hildenbrand (Red Hat)
@ 2026-01-15 9:20 ` David Hildenbrand (Red Hat)
2026-01-15 12:32 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 15/23] mm/balloon_compaction: assert that the balloon_pages_lock is held David Hildenbrand (Red Hat)
` (10 subsequent siblings)
24 siblings, 1 reply; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 9:20 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, David Hildenbrand (Red Hat),
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
Let's move the helpers that are not required by drivers anymore.
While at it, drop the doc of balloon_page_device() as it is trivial.
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
include/linux/balloon_compaction.h | 44 ------------------------------
mm/balloon_compaction.c | 38 ++++++++++++++++++++++++++
2 files changed, 38 insertions(+), 44 deletions(-)
diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
index d1d4739398978..eec8994056a44 100644
--- a/include/linux/balloon_compaction.h
+++ b/include/linux/balloon_compaction.h
@@ -75,48 +75,4 @@ static inline void balloon_devinfo_init(struct balloon_dev_info *balloon)
balloon->migratepage = NULL;
balloon->adjust_managed_page_count = false;
}
-
-#ifdef CONFIG_BALLOON_COMPACTION
-/*
- * balloon_page_device - get the b_dev_info descriptor for the balloon device
- * that enqueues the given page.
- */
-static inline struct balloon_dev_info *balloon_page_device(struct page *page)
-{
- return (struct balloon_dev_info *)page_private(page);
-}
-#endif /* CONFIG_BALLOON_COMPACTION */
-
-/*
- * balloon_page_insert - insert a page into the balloon's page list and make
- * the page->private assignment accordingly.
- * @balloon : pointer to balloon device
- * @page : page to be assigned as a 'balloon page'
- *
- * Caller must ensure the balloon_pages_lock is held.
- */
-static inline void balloon_page_insert(struct balloon_dev_info *balloon,
- struct page *page)
-{
- __SetPageOffline(page);
- if (IS_ENABLED(CONFIG_BALLOON_COMPACTION)) {
- SetPageMovableOps(page);
- set_page_private(page, (unsigned long)balloon);
- }
- list_add(&page->lru, &balloon->pages);
-}
-
-/*
- * balloon_page_finalize - prepare a balloon page that was removed from the
- * balloon list for release to the page allocator
- * @page: page to be released to the page allocator
- *
- * Caller must ensure the balloon_pages_lock is held.
- */
-static inline void balloon_page_finalize(struct page *page)
-{
- if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
- set_page_private(page, 0);
- /* PageOffline is sticky until the page is freed to the buddy. */
-}
#endif /* _LINUX_BALLOON_COMPACTION_H */
diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c
index 709c57c00b481..717bc43732d09 100644
--- a/mm/balloon_compaction.c
+++ b/mm/balloon_compaction.c
@@ -17,6 +17,44 @@
*/
static DEFINE_SPINLOCK(balloon_pages_lock);
+static inline struct balloon_dev_info *balloon_page_device(struct page *page)
+{
+ return (struct balloon_dev_info *)page_private(page);
+}
+
+/*
+ * balloon_page_insert - insert a page into the balloon's page list and make
+ * the page->private assignment accordingly.
+ * @balloon : pointer to balloon device
+ * @page : page to be assigned as a 'balloon page'
+ *
+ * Caller must ensure the balloon_pages_lock is held.
+ */
+static inline void balloon_page_insert(struct balloon_dev_info *balloon,
+ struct page *page)
+{
+ __SetPageOffline(page);
+ if (IS_ENABLED(CONFIG_BALLOON_COMPACTION)) {
+ SetPageMovableOps(page);
+ set_page_private(page, (unsigned long)balloon);
+ }
+ list_add(&page->lru, &balloon->pages);
+}
+
+/*
+ * balloon_page_finalize - prepare a balloon page that was removed from the
+ * balloon list for release to the page allocator
+ * @page: page to be released to the page allocator
+ *
+ * Caller must ensure the balloon_pages_lock is held.
+ */
+static inline void balloon_page_finalize(struct page *page)
+{
+ if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
+ set_page_private(page, 0);
+ /* PageOffline is sticky until the page is freed to the buddy. */
+}
+
static void balloon_page_enqueue_one(struct balloon_dev_info *b_dev_info,
struct page *page)
{
--
2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 15/23] mm/balloon_compaction: assert that the balloon_pages_lock is held
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
` (13 preceding siblings ...)
2026-01-15 9:20 ` [PATCH v2 14/23] mm/balloon_compaction: move internal helpers to balloon_compaction.c David Hildenbrand (Red Hat)
@ 2026-01-15 9:20 ` David Hildenbrand (Red Hat)
2026-01-15 12:32 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 16/23] mm/balloon_compaction: mark remaining functions for having proper kerneldoc David Hildenbrand (Red Hat)
` (9 subsequent siblings)
24 siblings, 1 reply; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 9:20 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, David Hildenbrand (Red Hat),
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
Let's add some sanity checks for holding the balloon_pages_lock when
we're effectively inflating/deflating a page.
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
mm/balloon_compaction.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c
index 717bc43732d09..f6e0582bd7ffe 100644
--- a/mm/balloon_compaction.c
+++ b/mm/balloon_compaction.c
@@ -33,6 +33,7 @@ static inline struct balloon_dev_info *balloon_page_device(struct page *page)
static inline void balloon_page_insert(struct balloon_dev_info *balloon,
struct page *page)
{
+ lockdep_assert_held(&balloon_pages_lock);
__SetPageOffline(page);
if (IS_ENABLED(CONFIG_BALLOON_COMPACTION)) {
SetPageMovableOps(page);
@@ -50,6 +51,7 @@ static inline void balloon_page_insert(struct balloon_dev_info *balloon,
*/
static inline void balloon_page_finalize(struct page *page)
{
+ lockdep_assert_held(&balloon_pages_lock);
if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
set_page_private(page, 0);
/* PageOffline is sticky until the page is freed to the buddy. */
--
2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 16/23] mm/balloon_compaction: mark remaining functions for having proper kerneldoc
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
` (14 preceding siblings ...)
2026-01-15 9:20 ` [PATCH v2 15/23] mm/balloon_compaction: assert that the balloon_pages_lock is held David Hildenbrand (Red Hat)
@ 2026-01-15 9:20 ` David Hildenbrand (Red Hat)
2026-01-15 12:33 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 17/23] mm/balloon_compaction: remove "extern" from functions David Hildenbrand (Red Hat)
` (8 subsequent siblings)
24 siblings, 1 reply; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 9:20 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, David Hildenbrand (Red Hat),
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
Looks like all we are missing for proper kerneldoc is another "*".
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
mm/balloon_compaction.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c
index f6e0582bd7ffe..f41e4a179a431 100644
--- a/mm/balloon_compaction.c
+++ b/mm/balloon_compaction.c
@@ -22,7 +22,7 @@ static inline struct balloon_dev_info *balloon_page_device(struct page *page)
return (struct balloon_dev_info *)page_private(page);
}
-/*
+/**
* balloon_page_insert - insert a page into the balloon's page list and make
* the page->private assignment accordingly.
* @balloon : pointer to balloon device
@@ -42,7 +42,7 @@ static inline void balloon_page_insert(struct balloon_dev_info *balloon,
list_add(&page->lru, &balloon->pages);
}
-/*
+/**
* balloon_page_finalize - prepare a balloon page that was removed from the
* balloon list for release to the page allocator
* @page: page to be released to the page allocator
@@ -140,7 +140,7 @@ size_t balloon_page_list_dequeue(struct balloon_dev_info *b_dev_info,
}
EXPORT_SYMBOL_GPL(balloon_page_list_dequeue);
-/*
+/**
* balloon_page_alloc - allocates a new page for insertion into the balloon
* page list.
*
@@ -163,7 +163,7 @@ struct page *balloon_page_alloc(void)
}
EXPORT_SYMBOL_GPL(balloon_page_alloc);
-/*
+/**
* balloon_page_enqueue - inserts a new page into the balloon page list.
*
* @b_dev_info: balloon device descriptor where we will insert a new page
@@ -186,7 +186,7 @@ void balloon_page_enqueue(struct balloon_dev_info *b_dev_info,
}
EXPORT_SYMBOL_GPL(balloon_page_enqueue);
-/*
+/**
* balloon_page_dequeue - removes a page from balloon's page list and returns
* its address to allow the driver to release the page.
* @b_dev_info: balloon device descriptor where we will grab a page from.
--
2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 17/23] mm/balloon_compaction: remove "extern" from functions
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
` (15 preceding siblings ...)
2026-01-15 9:20 ` [PATCH v2 16/23] mm/balloon_compaction: mark remaining functions for having proper kerneldoc David Hildenbrand (Red Hat)
@ 2026-01-15 9:20 ` David Hildenbrand (Red Hat)
2026-01-15 12:34 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 18/23] mm/vmscan: drop inclusion of balloon_compaction.h David Hildenbrand (Red Hat)
` (7 subsequent siblings)
24 siblings, 1 reply; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 9:20 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, David Hildenbrand (Red Hat),
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
Adding "extern" to functions is frowned-upon. Let's just get rid of it
for all functions here.
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
include/linux/balloon_compaction.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
index eec8994056a44..7757e0e314fdb 100644
--- a/include/linux/balloon_compaction.h
+++ b/include/linux/balloon_compaction.h
@@ -59,14 +59,14 @@ struct balloon_dev_info {
bool adjust_managed_page_count;
};
-extern struct page *balloon_page_alloc(void);
-extern void balloon_page_enqueue(struct balloon_dev_info *b_dev_info,
- struct page *page);
-extern struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info);
-extern size_t balloon_page_list_enqueue(struct balloon_dev_info *b_dev_info,
- struct list_head *pages);
-extern size_t balloon_page_list_dequeue(struct balloon_dev_info *b_dev_info,
- struct list_head *pages, size_t n_req_pages);
+struct page *balloon_page_alloc(void);
+void balloon_page_enqueue(struct balloon_dev_info *b_dev_info,
+ struct page *page);
+struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info);
+size_t balloon_page_list_enqueue(struct balloon_dev_info *b_dev_info,
+ struct list_head *pages);
+size_t balloon_page_list_dequeue(struct balloon_dev_info *b_dev_info,
+ struct list_head *pages, size_t n_req_pages);
static inline void balloon_devinfo_init(struct balloon_dev_info *balloon)
{
--
2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 18/23] mm/vmscan: drop inclusion of balloon_compaction.h
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
` (16 preceding siblings ...)
2026-01-15 9:20 ` [PATCH v2 17/23] mm/balloon_compaction: remove "extern" from functions David Hildenbrand (Red Hat)
@ 2026-01-15 9:20 ` David Hildenbrand (Red Hat)
2026-01-15 13:42 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 19/23] mm: rename balloon_compaction.(c|h) to balloon.(c|h) David Hildenbrand (Red Hat)
` (6 subsequent siblings)
24 siblings, 1 reply; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 9:20 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, David Hildenbrand (Red Hat),
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
Before commit b1123ea6d3b3 ("mm: balloon: use general non-lru movable page
feature"), the include was required because of isolated_balloon_page().
It's no longer required, so let's remove it.
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
mm/vmscan.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index a0e3f51de749e..cd9f9a779e89b 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -63,7 +63,6 @@
#include <asm/div64.h>
#include <linux/swapops.h>
-#include <linux/balloon_compaction.h>
#include <linux/sched/sysctl.h>
#include "internal.h"
--
2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 19/23] mm: rename balloon_compaction.(c|h) to balloon.(c|h)
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
` (17 preceding siblings ...)
2026-01-15 9:20 ` [PATCH v2 18/23] mm/vmscan: drop inclusion of balloon_compaction.h David Hildenbrand (Red Hat)
@ 2026-01-15 9:20 ` David Hildenbrand (Red Hat)
2026-01-15 13:45 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 20/23] mm/kconfig: make BALLOON_COMPACTION depend on MIGRATION David Hildenbrand (Red Hat)
` (5 subsequent siblings)
24 siblings, 1 reply; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 9:20 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, David Hildenbrand (Red Hat),
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
Even without CONFIG_BALLOON_COMPACTION this infrastructure implements
basic list and page management for a memory balloon.
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
Documentation/core-api/mm-api.rst | 2 +-
MAINTAINERS | 4 ++--
arch/powerpc/platforms/pseries/cmm.c | 2 +-
drivers/misc/vmw_balloon.c | 2 +-
drivers/virtio/virtio_balloon.c | 2 +-
include/linux/{balloon_compaction.h => balloon.h} | 11 +++++------
mm/Makefile | 2 +-
mm/{balloon_compaction.c => balloon.c} | 7 +++----
8 files changed, 15 insertions(+), 17 deletions(-)
rename include/linux/{balloon_compaction.h => balloon.h} (92%)
rename mm/{balloon_compaction.c => balloon.c} (98%)
diff --git a/Documentation/core-api/mm-api.rst b/Documentation/core-api/mm-api.rst
index 68193a4cfcf52..aabdd3cba58e8 100644
--- a/Documentation/core-api/mm-api.rst
+++ b/Documentation/core-api/mm-api.rst
@@ -130,5 +130,5 @@ More Memory Management Functions
.. kernel-doc:: mm/vmscan.c
.. kernel-doc:: mm/memory_hotplug.c
.. kernel-doc:: mm/mmu_notifier.c
-.. kernel-doc:: mm/balloon_compaction.c
+.. kernel-doc:: mm/balloon.c
.. kernel-doc:: mm/huge_memory.c
diff --git a/MAINTAINERS b/MAINTAINERS
index 0d044a58cbfe0..de8f89ca1149f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -27536,9 +27536,9 @@ M: David Hildenbrand <david@kernel.org>
L: virtualization@lists.linux.dev
S: Maintained
F: drivers/virtio/virtio_balloon.c
-F: include/linux/balloon_compaction.h
+F: include/linux/balloon.h
F: include/uapi/linux/virtio_balloon.h
-F: mm/balloon_compaction.c
+F: mm/balloon.c
VIRTIO BLOCK AND SCSI DRIVERS
M: "Michael S. Tsirkin" <mst@redhat.com>
diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
index 7fd8b3d7e7637..7a3c4922685ab 100644
--- a/arch/powerpc/platforms/pseries/cmm.c
+++ b/arch/powerpc/platforms/pseries/cmm.c
@@ -19,7 +19,7 @@
#include <linux/stringify.h>
#include <linux/swap.h>
#include <linux/device.h>
-#include <linux/balloon_compaction.h>
+#include <linux/balloon.h>
#include <asm/firmware.h>
#include <asm/hvcall.h>
#include <asm/mmu.h>
diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
index 53e9335b6718c..7fd3f709108c2 100644
--- a/drivers/misc/vmw_balloon.c
+++ b/drivers/misc/vmw_balloon.c
@@ -29,7 +29,7 @@
#include <linux/rwsem.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
-#include <linux/balloon_compaction.h>
+#include <linux/balloon.h>
#include <linux/vmw_vmci_defs.h>
#include <linux/vmw_vmci_api.h>
#include <asm/hypervisor.h>
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 6ae00de78b61b..de8041c3285a1 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -13,7 +13,7 @@
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/module.h>
-#include <linux/balloon_compaction.h>
+#include <linux/balloon.h>
#include <linux/oom.h>
#include <linux/wait.h>
#include <linux/mm.h>
diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon.h
similarity index 92%
rename from include/linux/balloon_compaction.h
rename to include/linux/balloon.h
index 7757e0e314fdb..82585542300d6 100644
--- a/include/linux/balloon_compaction.h
+++ b/include/linux/balloon.h
@@ -1,8 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
- * include/linux/balloon_compaction.h
- *
- * Common interface definitions for making balloon pages movable by compaction.
+ * Common interface for implementing a memory balloon, including support
+ * for migration of pages inflated in a memory balloon.
*
* Balloon page migration makes use of the general "movable_ops page migration"
* feature.
@@ -35,8 +34,8 @@
*
* Copyright (C) 2012, Red Hat, Inc. Rafael Aquini <aquini@redhat.com>
*/
-#ifndef _LINUX_BALLOON_COMPACTION_H
-#define _LINUX_BALLOON_COMPACTION_H
+#ifndef _LINUX_BALLOON_H
+#define _LINUX_BALLOON_H
#include <linux/pagemap.h>
#include <linux/page-flags.h>
#include <linux/migrate.h>
@@ -75,4 +74,4 @@ static inline void balloon_devinfo_init(struct balloon_dev_info *balloon)
balloon->migratepage = NULL;
balloon->adjust_managed_page_count = false;
}
-#endif /* _LINUX_BALLOON_COMPACTION_H */
+#endif /* _LINUX_BALLOON_H */
diff --git a/mm/Makefile b/mm/Makefile
index 9175f8cc65658..1e31e0a528dc1 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -122,7 +122,7 @@ obj-$(CONFIG_CMA) += cma.o
obj-$(CONFIG_NUMA) += numa.o
obj-$(CONFIG_NUMA_MEMBLKS) += numa_memblks.o
obj-$(CONFIG_NUMA_EMU) += numa_emulation.o
-obj-$(CONFIG_MEMORY_BALLOON) += balloon_compaction.o
+obj-$(CONFIG_MEMORY_BALLOON) += balloon.o
obj-$(CONFIG_PAGE_EXTENSION) += page_ext.o
obj-$(CONFIG_PAGE_TABLE_CHECK) += page_table_check.o
obj-$(CONFIG_CMA_DEBUGFS) += cma_debug.o
diff --git a/mm/balloon_compaction.c b/mm/balloon.c
similarity index 98%
rename from mm/balloon_compaction.c
rename to mm/balloon.c
index f41e4a179a431..5734dae81e318 100644
--- a/mm/balloon_compaction.c
+++ b/mm/balloon.c
@@ -1,15 +1,14 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
- * mm/balloon_compaction.c
- *
- * Common interface for making balloon pages movable by compaction.
+ * Common interface for implementing a memory balloon, including support
+ * for migration of pages inflated in a memory balloon.
*
* Copyright (C) 2012, Red Hat, Inc. Rafael Aquini <aquini@redhat.com>
*/
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/export.h>
-#include <linux/balloon_compaction.h>
+#include <linux/balloon.h>
/*
* Lock protecting the balloon_dev_info of all devices. We don't really
--
2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 20/23] mm/kconfig: make BALLOON_COMPACTION depend on MIGRATION
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
` (18 preceding siblings ...)
2026-01-15 9:20 ` [PATCH v2 19/23] mm: rename balloon_compaction.(c|h) to balloon.(c|h) David Hildenbrand (Red Hat)
@ 2026-01-15 9:20 ` David Hildenbrand (Red Hat)
2026-01-15 13:47 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 21/23] mm: rename CONFIG_BALLOON_COMPACTION to CONFIG_BALLOON_MIGRATION David Hildenbrand (Red Hat)
` (4 subsequent siblings)
24 siblings, 1 reply; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 9:20 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, David Hildenbrand (Red Hat),
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
Migration support for balloon memory depends on MIGRATION not
COMPACTION. Compaction is simply another user of page migration.
The last dependency on compaction.c was effectively removed with
commit 3d388584d599 ("mm: convert "movable" flag in page->mapping to a
page flag"). Ever since, everything for handling movable_ops page
migration resides in core migration code.
So let's change the dependency and adjust the description +
help text.
We'll rename BALLOON_COMPACTION separately next.
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
mm/Kconfig | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/mm/Kconfig b/mm/Kconfig
index 24a3ff149a1b0..0d13c1b36e1c1 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -599,17 +599,14 @@ config MEMORY_BALLOON
#
# support for memory balloon compaction
config BALLOON_COMPACTION
- bool "Allow for balloon memory compaction/migration"
+ bool "Allow for balloon memory migration"
default y
- depends on COMPACTION && MEMORY_BALLOON
- help
- Memory fragmentation introduced by ballooning might reduce
- significantly the number of 2MB contiguous memory blocks that can be
- used within a guest, thus imposing performance penalties associated
- with the reduced number of transparent huge pages that could be used
- by the guest workload. Allowing the compaction & migration for memory
- pages enlisted as being part of memory balloon devices avoids the
- scenario aforementioned and helps improving memory defragmentation.
+ depends on MIGRATION && MEMORY_BALLOON
+ help
+ Allow for migration of pages inflated in a memory balloon such that
+ they can be allocated from memory areas only available for movable
+ allocations (e.g., ZONE_MOVABLE, CMA) and such that they can be
+ migrated for memory defragmentation purposes by memory compaction.
#
# support for memory compaction
--
2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 21/23] mm: rename CONFIG_BALLOON_COMPACTION to CONFIG_BALLOON_MIGRATION
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
` (19 preceding siblings ...)
2026-01-15 9:20 ` [PATCH v2 20/23] mm/kconfig: make BALLOON_COMPACTION depend on MIGRATION David Hildenbrand (Red Hat)
@ 2026-01-15 9:20 ` David Hildenbrand (Red Hat)
2026-01-15 13:52 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 22/23] mm: rename CONFIG_MEMORY_BALLOON -> CONFIG_BALLOON David Hildenbrand (Red Hat)
` (3 subsequent siblings)
24 siblings, 1 reply; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 9:20 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, David Hildenbrand (Red Hat),
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
While compaction depends on migration, the other direction is not the
case. So let's make it clearer that this is all about migration of
balloon pages.
Adjust all comments/docs in the core to talk about "migration" instead
of "compaction".
While at it add some "/* CONFIG_BALLOON_MIGRATION */".
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
Documentation/admin-guide/mm/memory-hotplug.rst | 8 ++++----
arch/powerpc/platforms/pseries/cmm.c | 8 ++++----
drivers/misc/vmw_balloon.c | 8 ++++----
drivers/virtio/virtio_balloon.c | 6 +++---
include/linux/balloon.h | 2 +-
include/linux/vm_event_item.h | 4 ++--
mm/Kconfig | 4 ++--
mm/balloon.c | 10 +++++-----
mm/memory_hotplug.c | 4 ++--
mm/migrate.c | 2 +-
mm/vmstat.c | 4 ++--
11 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/Documentation/admin-guide/mm/memory-hotplug.rst b/Documentation/admin-guide/mm/memory-hotplug.rst
index 6581558fd0d7a..0207f87251421 100644
--- a/Documentation/admin-guide/mm/memory-hotplug.rst
+++ b/Documentation/admin-guide/mm/memory-hotplug.rst
@@ -603,11 +603,11 @@ ZONE_MOVABLE, especially when fine-tuning zone ratios:
memory for metadata and page tables in the direct map; having a lot of offline
memory blocks is not a typical case, though.
-- Memory ballooning without balloon compaction is incompatible with
- ZONE_MOVABLE. Only some implementations, such as virtio-balloon and
- pseries CMM, fully support balloon compaction.
+- Memory ballooning without support for balloon memory migration is incompatible
+ with ZONE_MOVABLE. Only some implementations, such as virtio-balloon and
+ pseries CMM, fully support balloon memory migration.
- Further, the CONFIG_BALLOON_COMPACTION kernel configuration option might be
+ Further, the CONFIG_BALLOON_MIGRATION kernel configuration option might be
disabled. In that case, balloon inflation will only perform unmovable
allocations and silently create a zone imbalance, usually triggered by
inflation requests from the hypervisor.
diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
index 7a3c4922685ab..8d83df12430f2 100644
--- a/arch/powerpc/platforms/pseries/cmm.c
+++ b/arch/powerpc/platforms/pseries/cmm.c
@@ -494,7 +494,7 @@ static struct notifier_block cmm_mem_nb = {
.priority = CMM_MEM_HOTPLUG_PRI
};
-#ifdef CONFIG_BALLOON_COMPACTION
+#ifdef CONFIG_BALLOON_MIGRATION
static int cmm_migratepage(struct balloon_dev_info *b_dev_info,
struct page *newpage, struct page *page,
enum migrate_mode mode)
@@ -520,10 +520,10 @@ static int cmm_migratepage(struct balloon_dev_info *b_dev_info,
plpar_page_set_active(page);
return 0;
}
-#else /* CONFIG_BALLOON_COMPACTION */
+#else /* CONFIG_BALLOON_MIGRATION */
int cmm_migratepage(struct balloon_dev_info *b_dev_info, struct page *newpage,
struct page *page, enum migrate_mode mode);
-#endif /* CONFIG_BALLOON_COMPACTION */
+#endif /* CONFIG_BALLOON_MIGRATION */
/**
* cmm_init - Module initialization
@@ -540,7 +540,7 @@ static int cmm_init(void)
balloon_devinfo_init(&b_dev_info);
b_dev_info.adjust_managed_page_count = true;
- if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
+ if (IS_ENABLED(CONFIG_BALLOON_MIGRATION))
b_dev_info.migratepage = cmm_migratepage;
rc = register_oom_notifier(&cmm_oom_nb);
diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
index 7fd3f709108c2..216a163959684 100644
--- a/drivers/misc/vmw_balloon.c
+++ b/drivers/misc/vmw_balloon.c
@@ -1719,7 +1719,7 @@ static inline void vmballoon_debugfs_exit(struct vmballoon *b)
#endif /* CONFIG_DEBUG_FS */
-#ifdef CONFIG_BALLOON_COMPACTION
+#ifdef CONFIG_BALLOON_MIGRATION
/**
* vmballoon_migratepage() - migrates a balloon page.
* @b_dev_info: balloon device information descriptor.
@@ -1803,11 +1803,11 @@ static int vmballoon_migratepage(struct balloon_dev_info *b_dev_info,
up_read(&b->conf_sem);
return ret;
}
-#else /* CONFIG_BALLOON_COMPACTION */
+#else /* CONFIG_BALLOON_MIGRATION */
int vmballoon_migratepage(struct balloon_dev_info *b_dev_info,
struct page *newpage, struct page *page,
enum migrate_mode mode);
-#endif /* CONFIG_BALLOON_COMPACTION */
+#endif /* CONFIG_BALLOON_MIGRATION */
static int __init vmballoon_init(void)
{
@@ -1827,7 +1827,7 @@ static int __init vmballoon_init(void)
return error;
balloon_devinfo_init(&balloon.b_dev_info);
- if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
+ if (IS_ENABLED(CONFIG_BALLOON_MIGRATION))
balloon.b_dev_info.migratepage = vmballoon_migratepage;
INIT_LIST_HEAD(&balloon.huge_pages);
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index de8041c3285a1..4e549abe59ff1 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -802,7 +802,7 @@ static void report_free_page_func(struct work_struct *work)
}
}
-#ifdef CONFIG_BALLOON_COMPACTION
+#ifdef CONFIG_BALLOON_MIGRATION
/*
* virtballoon_migratepage - perform the balloon page migration on behalf of
* a compaction thread. (called under page lock)
@@ -851,7 +851,7 @@ static int virtballoon_migratepage(struct balloon_dev_info *vb_dev_info,
mutex_unlock(&vb->balloon_lock);
return 0;
}
-#endif /* CONFIG_BALLOON_COMPACTION */
+#endif /* CONFIG_BALLOON_MIGRATION */
static unsigned long shrink_free_pages(struct virtio_balloon *vb,
unsigned long pages_to_free)
@@ -948,7 +948,7 @@ static int virtballoon_probe(struct virtio_device *vdev)
if (!virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
vb->vb_dev_info.adjust_managed_page_count = true;
-#ifdef CONFIG_BALLOON_COMPACTION
+#ifdef CONFIG_BALLOON_MIGRATION
vb->vb_dev_info.migratepage = virtballoon_migratepage;
#endif
if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT)) {
diff --git a/include/linux/balloon.h b/include/linux/balloon.h
index 82585542300d6..e8da95ca4ad48 100644
--- a/include/linux/balloon.h
+++ b/include/linux/balloon.h
@@ -45,7 +45,7 @@
/*
* Balloon device information descriptor.
- * This struct is used to allow the common balloon compaction interface
+ * This struct is used to allow the common balloon page migration interface
* procedures to find the proper balloon device holding memory pages they'll
* have to cope for page compaction / migration, as well as it serves the
* balloon driver as a page book-keeper for its registered balloon devices.
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index 92f80b4d69a6d..fca34d3473b6b 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -125,9 +125,9 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
#ifdef CONFIG_MEMORY_BALLOON
BALLOON_INFLATE,
BALLOON_DEFLATE,
-#ifdef CONFIG_BALLOON_COMPACTION
+#ifdef CONFIG_BALLOON_MIGRATION
BALLOON_MIGRATE,
-#endif
+#endif /* CONFIG_BALLOON_MIGRATION */
#endif
#ifdef CONFIG_DEBUG_TLBFLUSH
NR_TLB_REMOTE_FLUSH, /* cpu tried to flush others' tlbs */
diff --git a/mm/Kconfig b/mm/Kconfig
index 0d13c1b36e1c1..460a148d5b71a 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -597,8 +597,8 @@ config MEMORY_BALLOON
bool
#
-# support for memory balloon compaction
-config BALLOON_COMPACTION
+# support for memory balloon page migration
+config BALLOON_MIGRATION
bool "Allow for balloon memory migration"
default y
depends on MIGRATION && MEMORY_BALLOON
diff --git a/mm/balloon.c b/mm/balloon.c
index 5734dae81e318..8a21c6b9a7f0a 100644
--- a/mm/balloon.c
+++ b/mm/balloon.c
@@ -34,7 +34,7 @@ static inline void balloon_page_insert(struct balloon_dev_info *balloon,
{
lockdep_assert_held(&balloon_pages_lock);
__SetPageOffline(page);
- if (IS_ENABLED(CONFIG_BALLOON_COMPACTION)) {
+ if (IS_ENABLED(CONFIG_BALLOON_MIGRATION)) {
SetPageMovableOps(page);
set_page_private(page, (unsigned long)balloon);
}
@@ -51,7 +51,7 @@ static inline void balloon_page_insert(struct balloon_dev_info *balloon,
static inline void balloon_page_finalize(struct page *page)
{
lockdep_assert_held(&balloon_pages_lock);
- if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
+ if (IS_ENABLED(CONFIG_BALLOON_MIGRATION))
set_page_private(page, 0);
/* PageOffline is sticky until the page is freed to the buddy. */
}
@@ -153,7 +153,7 @@ struct page *balloon_page_alloc(void)
{
gfp_t gfp_flags = __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN;
- if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
+ if (IS_ENABLED(CONFIG_BALLOON_MIGRATION))
gfp_flags |= GFP_HIGHUSER_MOVABLE;
else
gfp_flags |= GFP_HIGHUSER;
@@ -232,7 +232,7 @@ struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info)
}
EXPORT_SYMBOL_GPL(balloon_page_dequeue);
-#ifdef CONFIG_BALLOON_COMPACTION
+#ifdef CONFIG_BALLOON_MIGRATION
static bool balloon_page_isolate(struct page *page, isolate_mode_t mode)
@@ -340,4 +340,4 @@ static int __init balloon_init(void)
}
core_initcall(balloon_init);
-#endif /* CONFIG_BALLOON_COMPACTION */
+#endif /* CONFIG_BALLOON_MIGRATION */
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 389989a28abe0..bc805029da517 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -946,8 +946,8 @@ static struct zone *default_kernel_zone_for_pfn(int nid, unsigned long start_pfn
* We rely on "present pages" instead of "managed pages", as the latter is
* highly unreliable and dynamic in virtualized environments, and does not
* consider boot time allocations. For example, memory ballooning adjusts the
- * managed pages when inflating/deflating the balloon, and balloon compaction
- * can even migrate inflated pages between zones.
+ * managed pages when inflating/deflating the balloon, and balloon page
+ * migration can even migrate inflated pages between zones.
*
* Using "present pages" is better but some things to keep in mind are:
*
diff --git a/mm/migrate.c b/mm/migrate.c
index 4750a2ba15fef..1bf2cf8c44dd4 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -88,7 +88,7 @@ static const struct movable_operations *page_movable_ops(struct page *page)
* back to the buddy.
*/
if (PageOffline(page))
- /* Only balloon compaction sets PageOffline pages movable. */
+ /* Only balloon page migration sets PageOffline pages movable. */
return offline_movable_ops;
if (PageZsmalloc(page))
return zsmalloc_movable_ops;
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 6ae8891c9693e..e96a344ab5974 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1422,9 +1422,9 @@ const char * const vmstat_text[] = {
#ifdef CONFIG_MEMORY_BALLOON
[I(BALLOON_INFLATE)] = "balloon_inflate",
[I(BALLOON_DEFLATE)] = "balloon_deflate",
-#ifdef CONFIG_BALLOON_COMPACTION
+#ifdef CONFIG_BALLOON_MIGRATION
[I(BALLOON_MIGRATE)] = "balloon_migrate",
-#endif
+#endif /* CONFIG_BALLOON_MIGRATION */
#endif /* CONFIG_MEMORY_BALLOON */
#ifdef CONFIG_DEBUG_TLBFLUSH
[I(NR_TLB_REMOTE_FLUSH)] = "nr_tlb_remote_flush",
--
2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 22/23] mm: rename CONFIG_MEMORY_BALLOON -> CONFIG_BALLOON
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
` (20 preceding siblings ...)
2026-01-15 9:20 ` [PATCH v2 21/23] mm: rename CONFIG_BALLOON_COMPACTION to CONFIG_BALLOON_MIGRATION David Hildenbrand (Red Hat)
@ 2026-01-15 9:20 ` David Hildenbrand (Red Hat)
2026-01-15 13:55 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 23/23] MAINTAINERS: move memory balloon infrastructure to "MEMORY MANAGEMENT - BALLOON" David Hildenbrand (Red Hat)
` (2 subsequent siblings)
24 siblings, 1 reply; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 9:20 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, David Hildenbrand (Red Hat),
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
Let's make it consistent with the naming of the files but also with the
naming of CONFIG_BALLOON_MIGRATION.
While at it, add a "/* CONFIG_BALLOON */".
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
arch/powerpc/platforms/pseries/Kconfig | 2 +-
drivers/misc/Kconfig | 2 +-
drivers/virtio/Kconfig | 2 +-
include/linux/vm_event_item.h | 4 ++--
mm/Kconfig | 4 ++--
mm/Makefile | 2 +-
mm/vmstat.c | 4 ++--
7 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index 3e042218d6cd8..f7052b131a4c5 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -120,7 +120,7 @@ config PPC_SMLPAR
config CMM
tristate "Collaborative memory management"
depends on PPC_SMLPAR
- select MEMORY_BALLOON
+ select BALLOON
default y
help
Select this option, if you want to enable the kernel interface
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index d7d41b054b982..5cc79d1517af5 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -410,7 +410,7 @@ config DS1682
config VMWARE_BALLOON
tristate "VMware Balloon Driver"
depends on VMWARE_VMCI && X86 && HYPERVISOR_GUEST
- select MEMORY_BALLOON
+ select BALLOON
help
This is VMware physical memory management driver which acts
like a "balloon" that can be inflated to reclaim physical pages
diff --git a/drivers/virtio/Kconfig b/drivers/virtio/Kconfig
index 6db5235a7693d..ce5bc0d9ea287 100644
--- a/drivers/virtio/Kconfig
+++ b/drivers/virtio/Kconfig
@@ -112,7 +112,7 @@ config VIRTIO_PMEM
config VIRTIO_BALLOON
tristate "Virtio balloon driver"
depends on VIRTIO
- select MEMORY_BALLOON
+ select BALLOON
select PAGE_REPORTING
help
This driver supports increasing and decreasing the amount
diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
index fca34d3473b6b..22a139f82d75f 100644
--- a/include/linux/vm_event_item.h
+++ b/include/linux/vm_event_item.h
@@ -122,13 +122,13 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
THP_SWPOUT,
THP_SWPOUT_FALLBACK,
#endif
-#ifdef CONFIG_MEMORY_BALLOON
+#ifdef CONFIG_BALLOON
BALLOON_INFLATE,
BALLOON_DEFLATE,
#ifdef CONFIG_BALLOON_MIGRATION
BALLOON_MIGRATE,
#endif /* CONFIG_BALLOON_MIGRATION */
-#endif
+#endif /* CONFIG_BALLOON */
#ifdef CONFIG_DEBUG_TLBFLUSH
NR_TLB_REMOTE_FLUSH, /* cpu tried to flush others' tlbs */
NR_TLB_REMOTE_FLUSH_RECEIVED,/* cpu received ipi for flush */
diff --git a/mm/Kconfig b/mm/Kconfig
index 460a148d5b71a..8e23af521605e 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -593,7 +593,7 @@ config SPLIT_PMD_PTLOCKS
#
# support for memory balloon
-config MEMORY_BALLOON
+config BALLOON
bool
#
@@ -601,7 +601,7 @@ config MEMORY_BALLOON
config BALLOON_MIGRATION
bool "Allow for balloon memory migration"
default y
- depends on MIGRATION && MEMORY_BALLOON
+ depends on MIGRATION && BALLOON
help
Allow for migration of pages inflated in a memory balloon such that
they can be allocated from memory areas only available for movable
diff --git a/mm/Makefile b/mm/Makefile
index 1e31e0a528dc1..0d85b10dbdde4 100644
--- a/mm/Makefile
+++ b/mm/Makefile
@@ -122,7 +122,7 @@ obj-$(CONFIG_CMA) += cma.o
obj-$(CONFIG_NUMA) += numa.o
obj-$(CONFIG_NUMA_MEMBLKS) += numa_memblks.o
obj-$(CONFIG_NUMA_EMU) += numa_emulation.o
-obj-$(CONFIG_MEMORY_BALLOON) += balloon.o
+obj-$(CONFIG_BALLOON) += balloon.o
obj-$(CONFIG_PAGE_EXTENSION) += page_ext.o
obj-$(CONFIG_PAGE_TABLE_CHECK) += page_table_check.o
obj-$(CONFIG_CMA_DEBUGFS) += cma_debug.o
diff --git a/mm/vmstat.c b/mm/vmstat.c
index e96a344ab5974..0f64c898f79f8 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1419,13 +1419,13 @@ const char * const vmstat_text[] = {
[I(THP_SWPOUT)] = "thp_swpout",
[I(THP_SWPOUT_FALLBACK)] = "thp_swpout_fallback",
#endif
-#ifdef CONFIG_MEMORY_BALLOON
+#ifdef CONFIG_BALLOON
[I(BALLOON_INFLATE)] = "balloon_inflate",
[I(BALLOON_DEFLATE)] = "balloon_deflate",
#ifdef CONFIG_BALLOON_MIGRATION
[I(BALLOON_MIGRATE)] = "balloon_migrate",
#endif /* CONFIG_BALLOON_MIGRATION */
-#endif /* CONFIG_MEMORY_BALLOON */
+#endif /* CONFIG_BALLOON */
#ifdef CONFIG_DEBUG_TLBFLUSH
[I(NR_TLB_REMOTE_FLUSH)] = "nr_tlb_remote_flush",
[I(NR_TLB_REMOTE_FLUSH_RECEIVED)] = "nr_tlb_remote_flush_received",
--
2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [PATCH v2 23/23] MAINTAINERS: move memory balloon infrastructure to "MEMORY MANAGEMENT - BALLOON"
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
` (21 preceding siblings ...)
2026-01-15 9:20 ` [PATCH v2 22/23] mm: rename CONFIG_MEMORY_BALLOON -> CONFIG_BALLOON David Hildenbrand (Red Hat)
@ 2026-01-15 9:20 ` David Hildenbrand (Red Hat)
2026-01-15 9:32 ` Michael S. Tsirkin
` (2 more replies)
2026-01-15 9:32 ` [PATCH v2 00/23] mm: balloon infrastructure cleanups Michael S. Tsirkin
2026-01-15 18:49 ` Andrew Morton
24 siblings, 3 replies; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 9:20 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, David Hildenbrand (Red Hat),
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
Nowadays, there is nothing virtio-balloon specific anymore about these
files, the basic infrastructure is used by multiple memory balloon
drivers.
For now we'll route it through Andrew's tree, maybe in some future it
makes sense to route this through a separate tree.
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
MAINTAINERS | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index de8f89ca1149f..b974f8c1c2225 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -16454,6 +16454,16 @@ T: quilt git://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new
F: mm/
F: tools/mm/
+MEMORY MANAGEMENT - BALLOON
+M: Andrew Morton <akpm@linux-foundation.org>
+M: David Hildenbrand <david@redhat.com>
+L: linux-mm@kvack.org
+S: Maintained
+W: http://www.linux-mm.org
+T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
+F: include/linux/balloon.h
+F: mm/balloon.c
+
MEMORY MANAGEMENT - CORE
M: Andrew Morton <akpm@linux-foundation.org>
M: David Hildenbrand <david@kernel.org>
@@ -27536,9 +27546,7 @@ M: David Hildenbrand <david@kernel.org>
L: virtualization@lists.linux.dev
S: Maintained
F: drivers/virtio/virtio_balloon.c
-F: include/linux/balloon.h
F: include/uapi/linux/virtio_balloon.h
-F: mm/balloon.c
VIRTIO BLOCK AND SCSI DRIVERS
M: "Michael S. Tsirkin" <mst@redhat.com>
--
2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 23/23] MAINTAINERS: move memory balloon infrastructure to "MEMORY MANAGEMENT - BALLOON"
2026-01-15 9:20 ` [PATCH v2 23/23] MAINTAINERS: move memory balloon infrastructure to "MEMORY MANAGEMENT - BALLOON" David Hildenbrand (Red Hat)
@ 2026-01-15 9:32 ` Michael S. Tsirkin
2026-01-15 11:21 ` David Hildenbrand (Red Hat)
2026-01-15 9:38 ` Lance Yang
2026-01-15 9:39 ` Lorenzo Stoakes
2 siblings, 1 reply; 65+ messages in thread
From: Michael S. Tsirkin @ 2026-01-15 9:32 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On Thu, Jan 15, 2026 at 10:20:13AM +0100, David Hildenbrand (Red Hat) wrote:
> Nowadays, there is nothing virtio-balloon specific anymore about these
> files, the basic infrastructure is used by multiple memory balloon
> drivers.
>
> For now we'll route it through Andrew's tree, maybe in some future it
> makes sense to route this through a separate tree.
>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
> ---
> MAINTAINERS | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index de8f89ca1149f..b974f8c1c2225 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -16454,6 +16454,16 @@ T: quilt git://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new
> F: mm/
> F: tools/mm/
>
> +MEMORY MANAGEMENT - BALLOON
> +M: Andrew Morton <akpm@linux-foundation.org>
> +M: David Hildenbrand <david@redhat.com>
> +L: linux-mm@kvack.org
I'd still like virtualization@lists.linux.dev included, too.
> +S: Maintained
> +W: http://www.linux-mm.org
> +T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> +F: include/linux/balloon.h
> +F: mm/balloon.c
> +
> MEMORY MANAGEMENT - CORE
> M: Andrew Morton <akpm@linux-foundation.org>
> M: David Hildenbrand <david@kernel.org>
> @@ -27536,9 +27546,7 @@ M: David Hildenbrand <david@kernel.org>
> L: virtualization@lists.linux.dev
> S: Maintained
> F: drivers/virtio/virtio_balloon.c
> -F: include/linux/balloon.h
> F: include/uapi/linux/virtio_balloon.h
> -F: mm/balloon.c
>
> VIRTIO BLOCK AND SCSI DRIVERS
> M: "Michael S. Tsirkin" <mst@redhat.com>
> --
> 2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 00/23] mm: balloon infrastructure cleanups
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
` (22 preceding siblings ...)
2026-01-15 9:20 ` [PATCH v2 23/23] MAINTAINERS: move memory balloon infrastructure to "MEMORY MANAGEMENT - BALLOON" David Hildenbrand (Red Hat)
@ 2026-01-15 9:32 ` Michael S. Tsirkin
2026-01-15 11:26 ` David Hildenbrand (Red Hat)
2026-01-15 18:49 ` Andrew Morton
24 siblings, 1 reply; 65+ messages in thread
From: Michael S. Tsirkin @ 2026-01-15 9:32 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On Thu, Jan 15, 2026 at 10:19:50AM +0100, David Hildenbrand (Red Hat) wrote:
> I started with wanting to remove the dependency of the balloon
> infrastructure on the page lock, but ended up performing various other
> cleanups, some of which I had on my todo list for years.
>
> This series heavily cleans up and simplifies our balloon infrastructure,
> including our balloon page migration functionality.
>
> With this series, we no longer make use of the page lock for PageOffline
> pages as part of the balloon infrastructure (preparing for memdescs
> where PageOffline pages won't have any such lock), and simplifies
> migration handling such that refcounting can more easily be adjusted
> later (long-term focus is for PageOffline pages to not have a refcount
> either).
>
> Plenty of related cleanups.
>
> Heavily compile-tested and heavily runtime-tested with virtio-balloon.
> PPC CMM and the VMware balloon are untested and I'd appreciate a helping
> hand from people that have suitable environments.
>
> Not CCing maintainers for the vmscan.c and migrate.c change as they
> are rather trivial and I don't want to patchbomb them.
besides MAINTAINERS thing:
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> --
>
> This is based on mm/mm-unstable.
>
> v1 -> v2:
> * Rebased to latest mm/mm-unstable without any conflicts
> * Minor patch description/subject and comment fixups
> * Retested
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Oscar Salvador <osalvador@suse.de>
> Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> Cc: "Liam R. Howlett" <Liam.Howlett@oracle.com>
> Cc: Vlastimil Babka <vbabka@suse.cz>
> Cc: Mike Rapoport <rppt@kernel.org>
> Cc: Suren Baghdasaryan <surenb@google.com>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: Jonathan Corbet <corbet@lwn.net>
> Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Jerrin Shaji George <jerrin.shaji-george@broadcom.com>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
> Cc: "Eugenio Pérez" <eperezma@redhat.com>
> Cc: Zi Yan <ziy@nvidia.com>
>
> David Hildenbrand (Red Hat) (23):
> vmw_balloon: adjust BALLOON_DEFLATE when deflating while migrating
> vmw_balloon: remove vmballoon_compaction_init()
> powerpc/pseries/cmm: remove cmm_balloon_compaction_init()
> mm/balloon_compaction: centralize basic page migration handling
> mm/balloon_compaction: centralize adjust_managed_page_count() handling
> vmw_balloon: stop using the balloon_dev_info lock
> mm/balloon_compaction: use a device-independent balloon (list) lock
> mm/balloon_compaction: remove dependency on page lock
> mm/balloon_compaction: make balloon_mops static
> mm/balloon_compaction: drop fs.h include from balloon_compaction.h
> drivers/virtio/virtio_balloon: stop using balloon_page_push/pop()
> mm/balloon_compaction: remove balloon_page_push/pop()
> mm/balloon_compaction: fold balloon_mapping_gfp_mask() into
> balloon_page_alloc()
> mm/balloon_compaction: move internal helpers to balloon_compaction.c
> mm/balloon_compaction: assert that the balloon_pages_lock is held
> mm/balloon_compaction: mark remaining functions for having proper
> kerneldoc
> mm/balloon_compaction: remove "extern" from functions
> mm/vmscan: drop inclusion of balloon_compaction.h
> mm: rename balloon_compaction.(c|h) to balloon.(c|h)
> mm/kconfig: make BALLOON_COMPACTION depend on MIGRATION
> mm: rename CONFIG_BALLOON_COMPACTION to CONFIG_BALLOON_MIGRATION
> mm: rename CONFIG_MEMORY_BALLOON -> CONFIG_BALLOON
> MAINTAINERS: move memory balloon infrastructure to "MEMORY MANAGEMENT
> - BALLOON"
>
> .../admin-guide/mm/memory-hotplug.rst | 8 +-
> Documentation/core-api/mm-api.rst | 2 +-
> MAINTAINERS | 12 +-
> arch/powerpc/platforms/pseries/Kconfig | 2 +-
> arch/powerpc/platforms/pseries/cmm.c | 53 +----
> drivers/misc/Kconfig | 2 +-
> drivers/misc/vmw_balloon.c | 105 +++-------
> drivers/virtio/Kconfig | 2 +-
> drivers/virtio/virtio_balloon.c | 64 ++----
> include/linux/balloon.h | 77 +++++++
> include/linux/balloon_compaction.h | 160 ---------------
> include/linux/vm_event_item.h | 8 +-
> mm/Kconfig | 23 +--
> mm/Makefile | 2 +-
> mm/{balloon_compaction.c => balloon.c} | 194 +++++++++++++-----
> mm/memory_hotplug.c | 4 +-
> mm/migrate.c | 2 +-
> mm/vmscan.c | 1 -
> mm/vmstat.c | 8 +-
> 19 files changed, 314 insertions(+), 415 deletions(-)
> create mode 100644 include/linux/balloon.h
> delete mode 100644 include/linux/balloon_compaction.h
> rename mm/{balloon_compaction.c => balloon.c} (59%)
>
>
> base-commit: f8ed52ac0cfbddff992bb9600941bfe51e1e385a
> --
> 2.52.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 23/23] MAINTAINERS: move memory balloon infrastructure to "MEMORY MANAGEMENT - BALLOON"
2026-01-15 9:20 ` [PATCH v2 23/23] MAINTAINERS: move memory balloon infrastructure to "MEMORY MANAGEMENT - BALLOON" David Hildenbrand (Red Hat)
2026-01-15 9:32 ` Michael S. Tsirkin
@ 2026-01-15 9:38 ` Lance Yang
2026-01-15 11:22 ` David Hildenbrand (Red Hat)
2026-01-15 9:39 ` Lorenzo Stoakes
2 siblings, 1 reply; 65+ messages in thread
From: Lance Yang @ 2026-01-15 9:38 UTC (permalink / raw)
To: david
Cc: Liam.Howlett, akpm, arnd, bcm-kernel-feedback-list,
christophe.leroy, corbet, eperezma, gregkh, jasowang,
jerrin.shaji-george, linux-doc, linux-kernel, linux-mm,
linuxppc-dev, lorenzo.stoakes, maddy, mhocko, mpe, mst, npiggin,
osalvador, rppt, surenb, vbabka, virtualization, xuanzhuo, ziy,
Lance Yang
On Thu, 15 Jan 2026 10:20:13 +0100, David Hildenbrand (Red Hat) wrote:
> Nowadays, there is nothing virtio-balloon specific anymore about these
> files, the basic infrastructure is used by multiple memory balloon
> drivers.
>
> For now we'll route it through Andrew's tree, maybe in some future it
> makes sense to route this through a separate tree.
>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
> ---
> MAINTAINERS | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index de8f89ca1149f..b974f8c1c2225 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -16454,6 +16454,16 @@ T: quilt git://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new
> F: mm/
> F: tools/mm/
>
> +MEMORY MANAGEMENT - BALLOON
> +M: Andrew Morton <akpm@linux-foundation.org>
> +M: David Hildenbrand <david@redhat.com>
Should it be david@kernel.org instead?
> +L: linux-mm@kvack.org
> +S: Maintained
> +W: http://www.linux-mm.org
> +T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> +F: include/linux/balloon.h
> +F: mm/balloon.c
> +
> MEMORY MANAGEMENT - CORE
> M: Andrew Morton <akpm@linux-foundation.org>
> M: David Hildenbrand <david@kernel.org>
> @@ -27536,9 +27546,7 @@ M: David Hildenbrand <david@kernel.org>
> L: virtualization@lists.linux.dev
> S: Maintained
> F: drivers/virtio/virtio_balloon.c
> -F: include/linux/balloon.h
> F: include/uapi/linux/virtio_balloon.h
> -F: mm/balloon.c
>
> VIRTIO BLOCK AND SCSI DRIVERS
> M: "Michael S. Tsirkin" <mst@redhat.com>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 23/23] MAINTAINERS: move memory balloon infrastructure to "MEMORY MANAGEMENT - BALLOON"
2026-01-15 9:20 ` [PATCH v2 23/23] MAINTAINERS: move memory balloon infrastructure to "MEMORY MANAGEMENT - BALLOON" David Hildenbrand (Red Hat)
2026-01-15 9:32 ` Michael S. Tsirkin
2026-01-15 9:38 ` Lance Yang
@ 2026-01-15 9:39 ` Lorenzo Stoakes
2026-01-15 11:25 ` David Hildenbrand (Red Hat)
2 siblings, 1 reply; 65+ messages in thread
From: Lorenzo Stoakes @ 2026-01-15 9:39 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On Thu, Jan 15, 2026 at 10:20:13AM +0100, David Hildenbrand (Red Hat) wrote:
> Nowadays, there is nothing virtio-balloon specific anymore about these
> files, the basic infrastructure is used by multiple memory balloon
> drivers.
>
> For now we'll route it through Andrew's tree, maybe in some future it
> makes sense to route this through a separate tree.
>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
Assuming below fixed + Michael's concern addressed, LGTM so:
Acked-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
> MAINTAINERS | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index de8f89ca1149f..b974f8c1c2225 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -16454,6 +16454,16 @@ T: quilt git://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new
> F: mm/
> F: tools/mm/
>
> +MEMORY MANAGEMENT - BALLOON
> +M: Andrew Morton <akpm@linux-foundation.org>
> +M: David Hildenbrand <david@redhat.com>
david@kernel.org you mean? ;)
> +L: linux-mm@kvack.org
> +S: Maintained
> +W: http://www.linux-mm.org
> +T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
> +F: include/linux/balloon.h
> +F: mm/balloon.c
> +
> MEMORY MANAGEMENT - CORE
> M: Andrew Morton <akpm@linux-foundation.org>
> M: David Hildenbrand <david@kernel.org>
> @@ -27536,9 +27546,7 @@ M: David Hildenbrand <david@kernel.org>
> L: virtualization@lists.linux.dev
> S: Maintained
> F: drivers/virtio/virtio_balloon.c
> -F: include/linux/balloon.h
> F: include/uapi/linux/virtio_balloon.h
> -F: mm/balloon.c
>
> VIRTIO BLOCK AND SCSI DRIVERS
> M: "Michael S. Tsirkin" <mst@redhat.com>
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 01/23] vmw_balloon: adjust BALLOON_DEFLATE when deflating while migrating
2026-01-15 9:19 ` [PATCH v2 01/23] vmw_balloon: adjust BALLOON_DEFLATE when deflating while migrating David Hildenbrand (Red Hat)
@ 2026-01-15 9:56 ` Lorenzo Stoakes
0 siblings, 0 replies; 65+ messages in thread
From: Lorenzo Stoakes @ 2026-01-15 9:56 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan, SeongJae Park
On Thu, Jan 15, 2026 at 10:19:51AM +0100, David Hildenbrand (Red Hat) wrote:
> When we're effectively deflating the balloon while migrating a page
> because inflating the new page failed, we're not adjusting
> BALLOON_DEFLATE.
>
> Let's do that. This is a preparation for factoring out this handling to
> the core code, making it work in a similar way first.
>
> As this (deflating while migrating because of inflation error) is a
> corner case that I don't really expect to happen in practice
> and the stats are not that crucial, this likely doesn't classify as a fix.
>
> Reviewed-by: SeongJae Park <sj@kernel.org>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
Seems reasonable to me, so:
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
> drivers/misc/vmw_balloon.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
> index cc1d18b3df5ca..2cc34c4968fac 100644
> --- a/drivers/misc/vmw_balloon.c
> +++ b/drivers/misc/vmw_balloon.c
> @@ -1818,6 +1818,8 @@ static int vmballoon_migratepage(struct balloon_dev_info *b_dev_info,
> if (status == VMW_BALLOON_SUCCESS) {
> balloon_page_insert(&b->b_dev_info, newpage);
> __count_vm_event(BALLOON_MIGRATE);
> + } else {
> + __count_vm_event(BALLOON_DEFLATE);
> }
>
> /*
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 02/23] vmw_balloon: remove vmballoon_compaction_init()
2026-01-15 9:19 ` [PATCH v2 02/23] vmw_balloon: remove vmballoon_compaction_init() David Hildenbrand (Red Hat)
@ 2026-01-15 11:20 ` Lorenzo Stoakes
0 siblings, 0 replies; 65+ messages in thread
From: Lorenzo Stoakes @ 2026-01-15 11:20 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On Thu, Jan 15, 2026 at 10:19:52AM +0100, David Hildenbrand (Red Hat) wrote:
> Now that there is not a lot of logic left, let's just inline setting up
> the migration function and drop all these excessive comments that are
> not really required (or true) anymore.
>
> To avoid #ifdef in the caller we can instead use IS_ENABLED() and make
> the compiler happy by only providing the function declaration.
>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
Seems reasonable to me, so:
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
> drivers/misc/vmw_balloon.c | 30 +++++-------------------------
> 1 file changed, 5 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
> index 2cc34c4968fac..07e60a4b846aa 100644
> --- a/drivers/misc/vmw_balloon.c
> +++ b/drivers/misc/vmw_balloon.c
> @@ -1833,27 +1833,10 @@ static int vmballoon_migratepage(struct balloon_dev_info *b_dev_info,
> up_read(&b->conf_sem);
> return ret;
> }
> -
> -/**
> - * vmballoon_compaction_init() - initialized compaction for the balloon.
> - *
> - * @b: pointer to the balloon.
> - *
> - * If during the initialization a failure occurred, this function does not
> - * perform cleanup. The caller must call vmballoon_compaction_deinit() in this
> - * case.
> - *
> - * Return: zero on success or error code on failure.
> - */
> -static __init void vmballoon_compaction_init(struct vmballoon *b)
> -{
> - b->b_dev_info.migratepage = vmballoon_migratepage;
> -}
> -
> #else /* CONFIG_BALLOON_COMPACTION */
> -static inline void vmballoon_compaction_init(struct vmballoon *b)
> -{
> -}
> +int vmballoon_migratepage(struct balloon_dev_info *b_dev_info,
> + struct page *newpage, struct page *page,
> + enum migrate_mode mode);
> #endif /* CONFIG_BALLOON_COMPACTION */
>
> static int __init vmballoon_init(void)
> @@ -1873,12 +1856,9 @@ static int __init vmballoon_init(void)
> if (error)
> return error;
>
> - /*
> - * Initialization of compaction must be done after the call to
> - * balloon_devinfo_init() .
> - */
> balloon_devinfo_init(&balloon.b_dev_info);
> - vmballoon_compaction_init(&balloon);
> + if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
> + balloon.b_dev_info.migratepage = vmballoon_migratepage;
>
> INIT_LIST_HEAD(&balloon.huge_pages);
> spin_lock_init(&balloon.comm_lock);
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 23/23] MAINTAINERS: move memory balloon infrastructure to "MEMORY MANAGEMENT - BALLOON"
2026-01-15 9:32 ` Michael S. Tsirkin
@ 2026-01-15 11:21 ` David Hildenbrand (Red Hat)
0 siblings, 0 replies; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 11:21 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On 1/15/26 10:32, Michael S. Tsirkin wrote:
> On Thu, Jan 15, 2026 at 10:20:13AM +0100, David Hildenbrand (Red Hat) wrote:
>> Nowadays, there is nothing virtio-balloon specific anymore about these
>> files, the basic infrastructure is used by multiple memory balloon
>> drivers.
>>
>> For now we'll route it through Andrew's tree, maybe in some future it
>> makes sense to route this through a separate tree.
>>
>> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
>> ---
>> MAINTAINERS | 12 ++++++++++--
>> 1 file changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index de8f89ca1149f..b974f8c1c2225 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -16454,6 +16454,16 @@ T: quilt git://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new
>> F: mm/
>> F: tools/mm/
>>
>> +MEMORY MANAGEMENT - BALLOON
>> +M: Andrew Morton <akpm@linux-foundation.org>
>> +M: David Hildenbrand <david@redhat.com>
>> +L: linux-mm@kvack.org
>
> I'd still like virtualization@lists.linux.dev included, too.
Makes sense.
--
Cheers
David
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 23/23] MAINTAINERS: move memory balloon infrastructure to "MEMORY MANAGEMENT - BALLOON"
2026-01-15 9:38 ` Lance Yang
@ 2026-01-15 11:22 ` David Hildenbrand (Red Hat)
0 siblings, 0 replies; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 11:22 UTC (permalink / raw)
To: Lance Yang
Cc: Liam.Howlett, akpm, arnd, bcm-kernel-feedback-list,
christophe.leroy, corbet, eperezma, gregkh, jasowang,
jerrin.shaji-george, linux-doc, linux-kernel, linux-mm,
linuxppc-dev, lorenzo.stoakes, maddy, mhocko, mpe, mst, npiggin,
osalvador, rppt, surenb, vbabka, virtualization, xuanzhuo, ziy
On 1/15/26 10:38, Lance Yang wrote:
>
> On Thu, 15 Jan 2026 10:20:13 +0100, David Hildenbrand (Red Hat) wrote:
>> Nowadays, there is nothing virtio-balloon specific anymore about these
>> files, the basic infrastructure is used by multiple memory balloon
>> drivers.
>>
>> For now we'll route it through Andrew's tree, maybe in some future it
>> makes sense to route this through a separate tree.
>>
>> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
>> ---
>> MAINTAINERS | 12 ++++++++++--
>> 1 file changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index de8f89ca1149f..b974f8c1c2225 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -16454,6 +16454,16 @@ T: quilt git://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new
>> F: mm/
>> F: tools/mm/
>>
>> +MEMORY MANAGEMENT - BALLOON
>> +M: Andrew Morton <akpm@linux-foundation.org>
>> +M: David Hildenbrand <david@redhat.com>
>
> Should it be david@kernel.org instead?
Yes, the patch is apparently a bit older :)
--
Cheers
David
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 23/23] MAINTAINERS: move memory balloon infrastructure to "MEMORY MANAGEMENT - BALLOON"
2026-01-15 9:39 ` Lorenzo Stoakes
@ 2026-01-15 11:25 ` David Hildenbrand (Red Hat)
2026-01-15 12:01 ` Vlastimil Babka
0 siblings, 1 reply; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 11:25 UTC (permalink / raw)
To: Lorenzo Stoakes
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On 1/15/26 10:39, Lorenzo Stoakes wrote:
> On Thu, Jan 15, 2026 at 10:20:13AM +0100, David Hildenbrand (Red Hat) wrote:
>> Nowadays, there is nothing virtio-balloon specific anymore about these
>> files, the basic infrastructure is used by multiple memory balloon
>> drivers.
>>
>> For now we'll route it through Andrew's tree, maybe in some future it
>> makes sense to route this through a separate tree.
>>
>> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
>
> Assuming below fixed + Michael's concern addressed, LGTM so:
>
> Acked-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
>
>> ---
>> MAINTAINERS | 12 ++++++++++--
>> 1 file changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index de8f89ca1149f..b974f8c1c2225 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -16454,6 +16454,16 @@ T: quilt git://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new
>> F: mm/
>> F: tools/mm/
>>
>> +MEMORY MANAGEMENT - BALLOON
>> +M: Andrew Morton <akpm@linux-foundation.org>
>> +M: David Hildenbrand <david@redhat.com>
>
> david@kernel.org you mean? ;)
Maybe I just want all the patches to go to /dev/null soon? ;)
The following on top:
From 3d344330b1ff6088582fe8e3bbff49d1557eba22 Mon Sep 17 00:00:00 2001
From: "David Hildenbrand (Red Hat)" <david@kernel.org>
Date: Thu, 15 Jan 2026 12:23:57 +0100
Subject: [PATCH] fixup: MAINTAINERS: move memory balloon infrastructure to
"MEMORY MANAGEMENT - BALLOON"
CC the virt list and use the proper mail address.
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
MAINTAINERS | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index b974f8c1c2225..11720728d92f2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -16456,8 +16456,9 @@ F: tools/mm/
MEMORY MANAGEMENT - BALLOON
M: Andrew Morton <akpm@linux-foundation.org>
-M: David Hildenbrand <david@redhat.com>
+M: David Hildenbrand <david@kernel.org>
L: linux-mm@kvack.org
+L: virtualization@lists.linux.dev
S: Maintained
W: http://www.linux-mm.org
T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
--
2.52.0
Thanks!
--
Cheers
David
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 00/23] mm: balloon infrastructure cleanups
2026-01-15 9:32 ` [PATCH v2 00/23] mm: balloon infrastructure cleanups Michael S. Tsirkin
@ 2026-01-15 11:26 ` David Hildenbrand (Red Hat)
0 siblings, 0 replies; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 11:26 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On 1/15/26 10:32, Michael S. Tsirkin wrote:
> On Thu, Jan 15, 2026 at 10:19:50AM +0100, David Hildenbrand (Red Hat) wrote:
>> I started with wanting to remove the dependency of the balloon
>> infrastructure on the page lock, but ended up performing various other
>> cleanups, some of which I had on my todo list for years.
>>
>> This series heavily cleans up and simplifies our balloon infrastructure,
>> including our balloon page migration functionality.
>>
>> With this series, we no longer make use of the page lock for PageOffline
>> pages as part of the balloon infrastructure (preparing for memdescs
>> where PageOffline pages won't have any such lock), and simplifies
>> migration handling such that refcounting can more easily be adjusted
>> later (long-term focus is for PageOffline pages to not have a refcount
>> either).
>>
>> Plenty of related cleanups.
>>
>> Heavily compile-tested and heavily runtime-tested with virtio-balloon.
>> PPC CMM and the VMware balloon are untested and I'd appreciate a helping
>> hand from people that have suitable environments.
>>
>> Not CCing maintainers for the vmscan.c and migrate.c change as they
>> are rather trivial and I don't want to patchbomb them.
>
> besides MAINTAINERS thing:
>
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
Thanks!
--
Cheers
David
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 03/23] powerpc/pseries/cmm: remove cmm_balloon_compaction_init()
2026-01-15 9:19 ` [PATCH v2 03/23] powerpc/pseries/cmm: remove cmm_balloon_compaction_init() David Hildenbrand (Red Hat)
@ 2026-01-15 11:46 ` Lorenzo Stoakes
2026-01-19 22:44 ` David Hildenbrand (Red Hat)
0 siblings, 1 reply; 65+ messages in thread
From: Lorenzo Stoakes @ 2026-01-15 11:46 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On Thu, Jan 15, 2026 at 10:19:53AM +0100, David Hildenbrand (Red Hat) wrote:
> Now that there is not a lot of logic left, let's just inline setting up
> the migration function.
>
> To avoid #ifdef in the caller we can instead use IS_ENABLED() and make
> the compiler happy by only providing the function declaration.
>
> Now that the function is gone, drop the "out_balloon_compaction" label.
> Note that before commit 68f2736a8583 ("mm: Convert all PageMovable users
> to movable_operations") we actually had to undo something, now not anymore.
>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
Seems reasonable so:
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
> arch/powerpc/platforms/pseries/cmm.c | 16 +++++-----------
> 1 file changed, 5 insertions(+), 11 deletions(-)
>
> diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
> index 4cbbe2ee58aba..9a6efbc80d2ad 100644
> --- a/arch/powerpc/platforms/pseries/cmm.c
> +++ b/arch/powerpc/platforms/pseries/cmm.c
> @@ -548,15 +548,9 @@ static int cmm_migratepage(struct balloon_dev_info *b_dev_info,
>
> return 0;
> }
> -
> -static void cmm_balloon_compaction_init(void)
> -{
> - b_dev_info.migratepage = cmm_migratepage;
> -}
> #else /* CONFIG_BALLOON_COMPACTION */
> -static void cmm_balloon_compaction_init(void)
> -{
> -}
> +int cmm_migratepage(struct balloon_dev_info *b_dev_info, struct page *newpage,
> + struct page *page, enum migrate_mode mode);
> #endif /* CONFIG_BALLOON_COMPACTION */
>
> /**
> @@ -573,11 +567,12 @@ static int cmm_init(void)
> return -EOPNOTSUPP;
>
> balloon_devinfo_init(&b_dev_info);
> - cmm_balloon_compaction_init();
> + if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
> + b_dev_info.migratepage = cmm_migratepage;
>
> rc = register_oom_notifier(&cmm_oom_nb);
> if (rc < 0)
> - goto out_balloon_compaction;
> + return rc;
>
> if ((rc = register_reboot_notifier(&cmm_reboot_nb)))
> goto out_oom_notifier;
> @@ -606,7 +601,6 @@ static int cmm_init(void)
> unregister_reboot_notifier(&cmm_reboot_nb);
> out_oom_notifier:
> unregister_oom_notifier(&cmm_oom_nb);
> -out_balloon_compaction:
So silly, I assume before there was more that happened here?
> return rc;
> }
>
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 23/23] MAINTAINERS: move memory balloon infrastructure to "MEMORY MANAGEMENT - BALLOON"
2026-01-15 11:25 ` David Hildenbrand (Red Hat)
@ 2026-01-15 12:01 ` Vlastimil Babka
0 siblings, 0 replies; 65+ messages in thread
From: Vlastimil Babka @ 2026-01-15 12:01 UTC (permalink / raw)
To: David Hildenbrand (Red Hat), Lorenzo Stoakes
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On 1/15/26 12:25, David Hildenbrand (Red Hat) wrote:
> On 1/15/26 10:39, Lorenzo Stoakes wrote:
>> On Thu, Jan 15, 2026 at 10:20:13AM +0100, David Hildenbrand (Red Hat) wrote:
>>> Nowadays, there is nothing virtio-balloon specific anymore about these
>>> files, the basic infrastructure is used by multiple memory balloon
>>> drivers.
>>>
>>> For now we'll route it through Andrew's tree, maybe in some future it
>>> makes sense to route this through a separate tree.
>>>
>>> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
>>
>> Assuming below fixed + Michael's concern addressed, LGTM so:
>>
>> Acked-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
>>
>>> ---
>>> MAINTAINERS | 12 ++++++++++--
>>> 1 file changed, 10 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/MAINTAINERS b/MAINTAINERS
>>> index de8f89ca1149f..b974f8c1c2225 100644
>>> --- a/MAINTAINERS
>>> +++ b/MAINTAINERS
>>> @@ -16454,6 +16454,16 @@ T: quilt git://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new
>>> F: mm/
>>> F: tools/mm/
>>>
>>> +MEMORY MANAGEMENT - BALLOON
>>> +M: Andrew Morton <akpm@linux-foundation.org>
>>> +M: David Hildenbrand <david@redhat.com>
>>
>> david@kernel.org you mean? ;)
>
> Maybe I just want all the patches to go to /dev/null soon? ;)
>
> The following on top:
>
>
> From 3d344330b1ff6088582fe8e3bbff49d1557eba22 Mon Sep 17 00:00:00 2001
> From: "David Hildenbrand (Red Hat)" <david@kernel.org>
> Date: Thu, 15 Jan 2026 12:23:57 +0100
> Subject: [PATCH] fixup: MAINTAINERS: move memory balloon infrastructure to
> "MEMORY MANAGEMENT - BALLOON"
>
> CC the virt list and use the proper mail address.
>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
for both
> ---
> MAINTAINERS | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index b974f8c1c2225..11720728d92f2 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -16456,8 +16456,9 @@ F: tools/mm/
>
> MEMORY MANAGEMENT - BALLOON
> M: Andrew Morton <akpm@linux-foundation.org>
> -M: David Hildenbrand <david@redhat.com>
> +M: David Hildenbrand <david@kernel.org>
> L: linux-mm@kvack.org
> +L: virtualization@lists.linux.dev
> S: Maintained
> W: http://www.linux-mm.org
> T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 04/23] mm/balloon_compaction: centralize basic page migration handling
2026-01-15 9:19 ` [PATCH v2 04/23] mm/balloon_compaction: centralize basic page migration handling David Hildenbrand (Red Hat)
@ 2026-01-15 12:18 ` Lorenzo Stoakes
2026-01-15 12:57 ` David Hildenbrand (Red Hat)
2026-01-19 22:22 ` David Hildenbrand (Red Hat)
1 sibling, 1 reply; 65+ messages in thread
From: Lorenzo Stoakes @ 2026-01-15 12:18 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On Thu, Jan 15, 2026 at 10:19:54AM +0100, David Hildenbrand (Red Hat) wrote:
> Let's update the balloon page references, the balloon page list, the
> BALLOON_MIGRATE counter and the isolated-pages counter in
> balloon_page_migrate(), after letting the balloon->migratepage()
> callback deal with the actual inflation+deflation.
>
> Note that we now perform the balloon list modifications outside of any
> implementation-specific locks: which is fine, there is nothing special
> about these page actions that the lock would be protecting.
>
> The old page is already no longer in the list (isolated) and the new page
> is not yet in the list.
>
> Let's use -ENOENT to communicate the special "inflation of new page
> failed after already deflating the old page" to balloon_page_migrate() so
> it can handle it accordingly.
>
> While at it, rename balloon->b_dev_info to make it match the other
> functions. Also, drop the comment above balloon_page_migrate(), which
> seems unnecessary.
>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
> ---
> arch/powerpc/platforms/pseries/cmm.c | 16 ---------
> drivers/misc/vmw_balloon.c | 49 +++++-----------------------
> drivers/virtio/virtio_balloon.c | 12 -------
> mm/balloon_compaction.c | 37 ++++++++++++++++++---
> 4 files changed, 41 insertions(+), 73 deletions(-)
>
> diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
> index 9a6efbc80d2ad..15f873f733a41 100644
> --- a/arch/powerpc/platforms/pseries/cmm.c
> +++ b/arch/powerpc/platforms/pseries/cmm.c
> @@ -501,8 +501,6 @@ static int cmm_migratepage(struct balloon_dev_info *b_dev_info,
> struct page *newpage, struct page *page,
> enum migrate_mode mode)
> {
> - unsigned long flags;
> -
> /*
> * loan/"inflate" the newpage first.
> *
> @@ -517,9 +515,6 @@ static int cmm_migratepage(struct balloon_dev_info *b_dev_info,
> return -EBUSY;
> }
>
> - /* balloon page list reference */
> - get_page(newpage);
> -
> /*
> * When we migrate a page to a different zone, we have to fixup the
> * count of both involved zones as we adjusted the managed page count
> @@ -530,22 +525,11 @@ static int cmm_migratepage(struct balloon_dev_info *b_dev_info,
> adjust_managed_page_count(newpage, -1);
> }
>
> - spin_lock_irqsave(&b_dev_info->pages_lock, flags);
> - balloon_page_insert(b_dev_info, newpage);
> - __count_vm_event(BALLOON_MIGRATE);
> - b_dev_info->isolated_pages--;
> - spin_unlock_irqrestore(&b_dev_info->pages_lock, flags);
> -
> /*
> * activate/"deflate" the old page. We ignore any errors just like the
> * other callers.
> */
> plpar_page_set_active(page);
> -
> - balloon_page_finalize(page);
> - /* balloon page list reference */
> - put_page(page);
> -
> return 0;
> }
> #else /* CONFIG_BALLOON_COMPACTION */
> diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
> index 07e60a4b846aa..52b8c0f1eead7 100644
> --- a/drivers/misc/vmw_balloon.c
> +++ b/drivers/misc/vmw_balloon.c
> @@ -1724,18 +1724,17 @@ static inline void vmballoon_debugfs_exit(struct vmballoon *b)
> * @page: a ballooned page that should be migrated.
> * @mode: migration mode, ignored.
> *
> - * This function is really open-coded, but that is according to the interface
> - * that balloon_compaction provides.
> - *
> * Return: zero on success, -EAGAIN when migration cannot be performed
> - * momentarily, and -EBUSY if migration failed and should be retried
> - * with that specific page.
> + * momentarily, -EBUSY if migration failed and should be retried
> + * with that specific page, and -ENOENT when deflating @page
> + * succeeded but inflating @newpage failed, effectively deflating
> + * the balloon.
> */
> static int vmballoon_migratepage(struct balloon_dev_info *b_dev_info,
> struct page *newpage, struct page *page,
> enum migrate_mode mode)
> {
> - unsigned long status, flags;
> + unsigned long status;
> struct vmballoon *b;
> int ret = 0;
>
> @@ -1773,14 +1772,6 @@ static int vmballoon_migratepage(struct balloon_dev_info *b_dev_info,
> goto out_unlock;
> }
>
> - /*
> - * The page is isolated, so it is safe to delete it without holding
> - * @pages_lock . We keep holding @comm_lock since we will need it in a
> - * second.
> - */
> - balloon_page_finalize(page);
> - put_page(page);
> -
> /* Inflate */
> vmballoon_add_page(b, 0, newpage);
> status = vmballoon_lock_op(b, 1, VMW_BALLOON_4K_PAGE,
> @@ -1799,36 +1790,12 @@ static int vmballoon_migratepage(struct balloon_dev_info *b_dev_info,
> * change.
> */
> atomic64_dec(&b->size);
> - } else {
> /*
> - * Success. Take a reference for the page, and we will add it to
> - * the list after acquiring the lock.
> + * Tell the core that we're deflating the old page and don't
> + * need the new page.
> */
> - get_page(newpage);
> - }
> -
> - /* Update the balloon list under the @pages_lock */
> - spin_lock_irqsave(&b->b_dev_info.pages_lock, flags);
> -
> - /*
> - * On inflation success, we already took a reference for the @newpage.
> - * If we succeed just insert it to the list and update the statistics
> - * under the lock.
> - */
> - if (status == VMW_BALLOON_SUCCESS) {
> - balloon_page_insert(&b->b_dev_info, newpage);
> - __count_vm_event(BALLOON_MIGRATE);
> - } else {
> - __count_vm_event(BALLOON_DEFLATE);
> + ret = -ENOENT;
> }
> -
> - /*
> - * We deflated successfully, so regardless to the inflation success, we
> - * need to reduce the number of isolated_pages.
> - */
> - b->b_dev_info.isolated_pages--;
> - spin_unlock_irqrestore(&b->b_dev_info.pages_lock, flags);
> -
> out_unlock:
> up_read(&b->conf_sem);
> return ret;
> diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> index 74fe59f5a78c6..df2756c071dae 100644
> --- a/drivers/virtio/virtio_balloon.c
> +++ b/drivers/virtio/virtio_balloon.c
> @@ -827,7 +827,6 @@ static int virtballoon_migratepage(struct balloon_dev_info *vb_dev_info,
> {
> struct virtio_balloon *vb = container_of(vb_dev_info,
> struct virtio_balloon, vb_dev_info);
> - unsigned long flags;
>
> /*
> * In order to avoid lock contention while migrating pages concurrently
> @@ -840,8 +839,6 @@ static int virtballoon_migratepage(struct balloon_dev_info *vb_dev_info,
> if (!mutex_trylock(&vb->balloon_lock))
> return -EAGAIN;
>
> - get_page(newpage); /* balloon reference */
> -
> /*
> * When we migrate a page to a different zone and adjusted the
> * managed page count when inflating, we have to fixup the count of
> @@ -854,11 +851,6 @@ static int virtballoon_migratepage(struct balloon_dev_info *vb_dev_info,
> }
>
> /* balloon's page migration 1st step -- inflate "newpage" */
> - spin_lock_irqsave(&vb_dev_info->pages_lock, flags);
> - balloon_page_insert(vb_dev_info, newpage);
> - vb_dev_info->isolated_pages--;
> - __count_vm_event(BALLOON_MIGRATE);
> - spin_unlock_irqrestore(&vb_dev_info->pages_lock, flags);
> vb->num_pfns = VIRTIO_BALLOON_PAGES_PER_PAGE;
> set_page_pfns(vb, vb->pfns, newpage);
> tell_host(vb, vb->inflate_vq);
> @@ -869,10 +861,6 @@ static int virtballoon_migratepage(struct balloon_dev_info *vb_dev_info,
> tell_host(vb, vb->deflate_vq);
>
> mutex_unlock(&vb->balloon_lock);
> -
> - balloon_page_finalize(page);
> - put_page(page); /* balloon reference */
> -
> return 0;
> }
> #endif /* CONFIG_BALLOON_COMPACTION */
> diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c
> index 03c5dbabb1565..5444c61bb9e76 100644
> --- a/mm/balloon_compaction.c
> +++ b/mm/balloon_compaction.c
> @@ -232,20 +232,49 @@ static void balloon_page_putback(struct page *page)
> spin_unlock_irqrestore(&b_dev_info->pages_lock, flags);
> }
>
> -/* move_to_new_page() counterpart for a ballooned page */
> static int balloon_page_migrate(struct page *newpage, struct page *page,
> enum migrate_mode mode)
I honestly wonder if page should be 'oldpage', or rather we should just match
args to the struct movable_operations e.g. dst, src?
> {
> - struct balloon_dev_info *balloon = balloon_page_device(page);
> + struct balloon_dev_info *b_dev_info = balloon_page_device(page);
> + unsigned long flags;
> + int rc;
>
> VM_BUG_ON_PAGE(!PageLocked(page), page);
> VM_BUG_ON_PAGE(!PageLocked(newpage), newpage);
>
> /* Isolated balloon pages cannot get deflated. */
Hmm, I'm a bit confused by this comment, isn't 'page' isolated?
This comment reads like !b_dev_info implies page isolated and thus a
WARN_ON_ONCE() issue, but later you say 'Free the now-deflated page we isolated
in balloon_page_isolate().' in reference to page?
So both can't be true.
> - if (WARN_ON_ONCE(!balloon))
> + if (WARN_ON_ONCE(!b_dev_info))
> return -EAGAIN;
>
> - return balloon->migratepage(balloon, newpage, page, mode);
> + rc = b_dev_info->migratepage(b_dev_info, newpage, page, mode);
> + switch (rc) {
> + case 0:
> + spin_lock_irqsave(&b_dev_info->pages_lock, flags);
> +
> + /* Insert the new page into the balloon list. */
Slightly weird to put this comment next to the pageref update then a newline
hten the actual insertion bit.
> + get_page(newpage);
> +
> + balloon_page_insert(b_dev_info, newpage);
> + __count_vm_event(BALLOON_MIGRATE);
> + break;
> + case -ENOENT:
> + spin_lock_irqsave(&b_dev_info->pages_lock, flags);
> +
> + /* Old page was deflated but new page not inflated. */
Weird reference to old page and new page when old page is 'page', with dst, src
we could just say destination/source?
> + __count_vm_event(BALLOON_DEFLATE);
> + break;
> + default:
> + return rc;
Don't we need to change the isolate stats etc. if we simply fail here? Or does
the movable ops logic correctly handle this for us?
Ah I guess baloon_page_putback() would be invoked :) Fun!
> + }
It's subjective and pedantic but I don't love this use of the switch here, it
really makes it seem like 'just another case' to do the _key_ action here of
migrating a balloon page. Also could compress things a bit, that's even more
subjective :)
Also it's kind of horrible to have the spin lock line duplicated like that,
that's more important and not clear on quick glance to see whether matching
lock/unlock.
So maybe change to something like:
rc = b_dev_info->migratepage(b_dev_info, newpage, page, mode);
if (rc < 0 && rc != -ENOENT)
return rc;
spin_lock_irqsave(&b_dev_info->pages_lock, flags);
if (rc == -ENOENT) {
/* Old page was deflated but new page not inflated. */
__count_vm_event(BALLOON_DEFLATE);
} else {
get_page(newpage);
/* Insert the new page into the balloon list. */
balloon_page_insert(b_dev_info, newpage);
__count_vm_event(BALLOON_MIGRATE);
}
Or even could be:
rc = b_dev_info->migratepage(b_dev_info, newpage, page, mode);
if (rc < 0 && rc != -ENOENT)
return rc;
spin_lock_irqsave(&b_dev_info->pages_lock, flags);
b_dev_info->isolated_pages--;
if (!rc) {
get_page(newpage);
/* Insert the new page into the balloon list. */
balloon_page_insert(b_dev_info, newpage);
__count_vm_event(BALLOON_MIGRATE);
}
spin_unlock_irqrestore(&b_dev_info->pages_lock, flags);
/* If -ENOENT, old page was deflated but new page not inflated. */
__count_vm_event(rc ? BALLOON_DEFLATE : BALLOON_MIGRATE);
To only lock over the operations that actually need it and to really highlight
the 'success' path?
> +
> + b_dev_info->isolated_pages--;
> + spin_unlock_irqrestore(&b_dev_info->pages_lock, flags);
> +
> + /* Free the now-deflated page we isolated in balloon_page_isolate(). */
> + balloon_page_finalize(page);
> + put_page(page);
OK so we get on migrate, but put the source page which would have got gotten
previously I guess?
> +
> + return 0;
> }
>
> const struct movable_operations balloon_mops = {
> --
> 2.52.0
>
Thanks, Lorenzo
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 06/23] vmw_balloon: stop using the balloon_dev_info lock
2026-01-15 9:19 ` [PATCH v2 06/23] vmw_balloon: stop using the balloon_dev_info lock David Hildenbrand (Red Hat)
@ 2026-01-15 12:21 ` Lorenzo Stoakes
2026-01-15 12:26 ` David Hildenbrand (Red Hat)
0 siblings, 1 reply; 65+ messages in thread
From: Lorenzo Stoakes @ 2026-01-15 12:21 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On Thu, Jan 15, 2026 at 10:19:56AM +0100, David Hildenbrand (Red Hat) wrote:
> Let's not piggy-back on the existing lock and use a separate lock for the
> huge page list. Now that we use a separate lock, there is no need to
> disable interrupts, so use the non-irqsave variants.
Why can we avoid disabling interrupts in this case?
>
> This is a preparation for changing the locking used to protect
> balloon_dev_info.
>
> While at it, talk about "page migration" instead of "page compaction".
> We'll change that in core code soon as well.
>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
Generally seems reasonable however, so:
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
> drivers/misc/vmw_balloon.c | 20 ++++++++++++--------
> 1 file changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
> index 52b8c0f1eead7..53e9335b6718c 100644
> --- a/drivers/misc/vmw_balloon.c
> +++ b/drivers/misc/vmw_balloon.c
> @@ -354,10 +354,15 @@ struct vmballoon {
> /**
> * @huge_pages - list of the inflated 2MB pages.
> *
> - * Protected by @b_dev_info.pages_lock .
> + * Protected by @huge_pages_lock.
> */
> struct list_head huge_pages;
>
> + /**
> + * @huge_pages_lock: lock for the list of inflated 2MB pages.
> + */
> + spinlock_t huge_pages_lock;
> +
> /**
> * @vmci_doorbell.
> *
> @@ -987,7 +992,6 @@ static void vmballoon_enqueue_page_list(struct vmballoon *b,
> unsigned int *n_pages,
> enum vmballoon_page_size_type page_size)
> {
> - unsigned long flags;
> struct page *page;
>
> if (page_size == VMW_BALLOON_4K_PAGE) {
> @@ -995,9 +999,9 @@ static void vmballoon_enqueue_page_list(struct vmballoon *b,
> } else {
> /*
> * Keep the huge pages in a local list which is not available
> - * for the balloon compaction mechanism.
> + * for the balloon page migration.
> */
> - spin_lock_irqsave(&b->b_dev_info.pages_lock, flags);
> + spin_lock(&b->huge_pages_lock);
>
> list_for_each_entry(page, pages, lru) {
> vmballoon_mark_page_offline(page, VMW_BALLOON_2M_PAGE);
> @@ -1006,7 +1010,7 @@ static void vmballoon_enqueue_page_list(struct vmballoon *b,
> list_splice_init(pages, &b->huge_pages);
> __count_vm_events(BALLOON_INFLATE, *n_pages *
> vmballoon_page_in_frames(VMW_BALLOON_2M_PAGE));
> - spin_unlock_irqrestore(&b->b_dev_info.pages_lock, flags);
> + spin_unlock(&b->huge_pages_lock);
> }
>
> *n_pages = 0;
> @@ -1033,7 +1037,6 @@ static void vmballoon_dequeue_page_list(struct vmballoon *b,
> {
> struct page *page, *tmp;
> unsigned int i = 0;
> - unsigned long flags;
>
> /* In the case of 4k pages, use the compaction infrastructure */
> if (page_size == VMW_BALLOON_4K_PAGE) {
> @@ -1043,7 +1046,7 @@ static void vmballoon_dequeue_page_list(struct vmballoon *b,
> }
>
> /* 2MB pages */
> - spin_lock_irqsave(&b->b_dev_info.pages_lock, flags);
> + spin_lock(&b->huge_pages_lock);
> list_for_each_entry_safe(page, tmp, &b->huge_pages, lru) {
> vmballoon_mark_page_online(page, VMW_BALLOON_2M_PAGE);
>
> @@ -1054,7 +1057,7 @@ static void vmballoon_dequeue_page_list(struct vmballoon *b,
>
> __count_vm_events(BALLOON_DEFLATE,
> i * vmballoon_page_in_frames(VMW_BALLOON_2M_PAGE));
> - spin_unlock_irqrestore(&b->b_dev_info.pages_lock, flags);
> + spin_unlock(&b->huge_pages_lock);
> *n_pages = i;
> }
>
> @@ -1828,6 +1831,7 @@ static int __init vmballoon_init(void)
> balloon.b_dev_info.migratepage = vmballoon_migratepage;
>
> INIT_LIST_HEAD(&balloon.huge_pages);
> + spin_lock_init(&balloon.huge_pages_lock);
> spin_lock_init(&balloon.comm_lock);
> init_rwsem(&balloon.conf_sem);
> balloon.vmci_doorbell = VMCI_INVALID_HANDLE;
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 09/23] mm/balloon_compaction: make balloon_mops static
2026-01-15 9:19 ` [PATCH v2 09/23] mm/balloon_compaction: make balloon_mops static David Hildenbrand (Red Hat)
@ 2026-01-15 12:22 ` Lorenzo Stoakes
0 siblings, 0 replies; 65+ messages in thread
From: Lorenzo Stoakes @ 2026-01-15 12:22 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On Thu, Jan 15, 2026 at 10:19:59AM +0100, David Hildenbrand (Red Hat) wrote:
> There is no need to expose this anymore, so let's just make it static.
>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
Seems reasonable, so:
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
> include/linux/balloon_compaction.h | 1 -
> mm/balloon_compaction.c | 2 +-
> 2 files changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
> index ad594af6ed100..7db66c2c86cdc 100644
> --- a/include/linux/balloon_compaction.h
> +++ b/include/linux/balloon_compaction.h
> @@ -78,7 +78,6 @@ static inline void balloon_devinfo_init(struct balloon_dev_info *balloon)
> }
>
> #ifdef CONFIG_BALLOON_COMPACTION
> -extern const struct movable_operations balloon_mops;
> /*
> * balloon_page_device - get the b_dev_info descriptor for the balloon device
> * that enqueues the given page.
> diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c
> index 28ef0cb6b3bbc..c44e0b62203cc 100644
> --- a/mm/balloon_compaction.c
> +++ b/mm/balloon_compaction.c
> @@ -286,7 +286,7 @@ static int balloon_page_migrate(struct page *newpage, struct page *page,
> return 0;
> }
>
> -const struct movable_operations balloon_mops = {
> +static const struct movable_operations balloon_mops = {
> .migrate_page = balloon_page_migrate,
> .isolate_page = balloon_page_isolate,
> .putback_page = balloon_page_putback,
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 10/23] mm/balloon_compaction: drop fs.h include from balloon_compaction.h
2026-01-15 9:20 ` [PATCH v2 10/23] mm/balloon_compaction: drop fs.h include from balloon_compaction.h David Hildenbrand (Red Hat)
@ 2026-01-15 12:25 ` Lorenzo Stoakes
0 siblings, 0 replies; 65+ messages in thread
From: Lorenzo Stoakes @ 2026-01-15 12:25 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On Thu, Jan 15, 2026 at 10:20:00AM +0100, David Hildenbrand (Red Hat) wrote:
> Ever since commit 68f2736a8583 ("mm: Convert all PageMovable users to
> movable_operations") we no longer store an inode in balloon_dev_info,
> so we can stop including "fs.h".
>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
This is a shocking, awful, horrifyingly massive change but reluctantly... only
kidding ;)
Yeah seems sensible so:
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
> include/linux/balloon_compaction.h | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
> index 7db66c2c86cdc..1452ea0635245 100644
> --- a/include/linux/balloon_compaction.h
> +++ b/include/linux/balloon_compaction.h
> @@ -42,7 +42,6 @@
> #include <linux/migrate.h>
> #include <linux/gfp.h>
> #include <linux/err.h>
> -#include <linux/fs.h>
> #include <linux/list.h>
>
> /*
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 06/23] vmw_balloon: stop using the balloon_dev_info lock
2026-01-15 12:21 ` Lorenzo Stoakes
@ 2026-01-15 12:26 ` David Hildenbrand (Red Hat)
0 siblings, 0 replies; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 12:26 UTC (permalink / raw)
To: Lorenzo Stoakes
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On 1/15/26 13:21, Lorenzo Stoakes wrote:
> On Thu, Jan 15, 2026 at 10:19:56AM +0100, David Hildenbrand (Red Hat) wrote:
>> Let's not piggy-back on the existing lock and use a separate lock for the
>> huge page list. Now that we use a separate lock, there is no need to
>> disable interrupts, so use the non-irqsave variants.
>
> Why can we avoid disabling interrupts in this case?
It's a leftover from using the old lock that required this.
Thanks!
--
Cheers
David
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 11/23] drivers/virtio/virtio_balloon: stop using balloon_page_push/pop()
2026-01-15 9:20 ` [PATCH v2 11/23] drivers/virtio/virtio_balloon: stop using balloon_page_push/pop() David Hildenbrand (Red Hat)
@ 2026-01-15 12:28 ` Lorenzo Stoakes
0 siblings, 0 replies; 65+ messages in thread
From: Lorenzo Stoakes @ 2026-01-15 12:28 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On Thu, Jan 15, 2026 at 10:20:01AM +0100, David Hildenbrand (Red Hat) wrote:
> Let's stop using these functions so we can remove them. They look like
> belonging to the balloon API for managing the device balloon list when
> really they are just simple helpers only used by virtio-balloon.
>
> Let's just inline them and switch to a proper
> list_for_each_entry_safe().
>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
Overall LGTM, some small enquiry really below. So:
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
> drivers/virtio/virtio_balloon.c | 25 +++++++++++++++----------
> 1 file changed, 15 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> index 15c1cf5fd249c..6ae00de78b61b 100644
> --- a/drivers/virtio/virtio_balloon.c
> +++ b/drivers/virtio/virtio_balloon.c
> @@ -242,8 +242,8 @@ static void set_page_pfns(struct virtio_balloon *vb,
> static unsigned int fill_balloon(struct virtio_balloon *vb, size_t num)
> {
> unsigned int num_allocated_pages;
> + struct page *page, *next;
> unsigned int num_pfns;
> - struct page *page;
> LIST_HEAD(pages);
>
> /* We can only do one array worth at a time. */
> @@ -262,14 +262,15 @@ static unsigned int fill_balloon(struct virtio_balloon *vb, size_t num)
> break;
> }
>
> - balloon_page_push(&pages, page);
Seems this function is unused now, wonder if you remove in a subsequent patch?
If not should remove :)
Just had a look at it and what a silly function, guess was used for kinda
'self-documenting' that it was a balloon page insertion.
> + list_add(&page->lru, &pages);
> }
>
> mutex_lock(&vb->balloon_lock);
>
> vb->num_pfns = 0;
>
> - while ((page = balloon_page_pop(&pages))) {
> + list_for_each_entry_safe(page, next, &pages, lru) {
> + list_del(&page->lru);
> balloon_page_enqueue(&vb->vb_dev_info, page);
>
> set_page_pfns(vb, vb->pfns + vb->num_pfns, page);
> @@ -474,15 +475,19 @@ static inline s64 towards_target(struct virtio_balloon *vb)
> static unsigned long return_free_pages_to_mm(struct virtio_balloon *vb,
> unsigned long num_to_return)
> {
> - struct page *page;
> - unsigned long num_returned;
> + unsigned long num_returned = 0;
> + struct page *page, *next;
> +
> + if (unlikely(!num_to_return))
> + return 0;
>
> spin_lock_irq(&vb->free_page_list_lock);
> - for (num_returned = 0; num_returned < num_to_return; num_returned++) {
> - page = balloon_page_pop(&vb->free_page_list);
> - if (!page)
> - break;
> +
> + list_for_each_entry_safe(page, next, &vb->free_page_list, lru) {
> + list_del(&page->lru);
> __free_pages(page, VIRTIO_BALLOON_HINT_BLOCK_ORDER);
> + if (++num_returned == num_to_return)
> + break;
> }
> vb->num_free_page_blocks -= num_returned;
> spin_unlock_irq(&vb->free_page_list_lock);
> @@ -717,7 +722,7 @@ static int get_free_page_and_send(struct virtio_balloon *vb)
> }
> virtqueue_kick(vq);
> spin_lock_irq(&vb->free_page_list_lock);
> - balloon_page_push(&vb->free_page_list, page);
> + list_add(&page->lru, &vb->free_page_list);
> vb->num_free_page_blocks++;
> spin_unlock_irq(&vb->free_page_list_lock);
> } else {
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 12/23] mm/balloon_compaction: remove balloon_page_push/pop()
2026-01-15 9:20 ` [PATCH v2 12/23] mm/balloon_compaction: remove balloon_page_push/pop() David Hildenbrand (Red Hat)
@ 2026-01-15 12:29 ` Lorenzo Stoakes
0 siblings, 0 replies; 65+ messages in thread
From: Lorenzo Stoakes @ 2026-01-15 12:29 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On Thu, Jan 15, 2026 at 10:20:02AM +0100, David Hildenbrand (Red Hat) wrote:
> Let's remove these helpers as they are unused now.
>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
OK exactly as asked in the last patch you do deliver :))
So good riddance to this and:
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
> include/linux/balloon_compaction.h | 30 ------------------------------
> mm/balloon_compaction.c | 5 ++---
> 2 files changed, 2 insertions(+), 33 deletions(-)
>
> diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
> index 1452ea0635245..e5451cf1f6589 100644
> --- a/include/linux/balloon_compaction.h
> +++ b/include/linux/balloon_compaction.h
> @@ -126,34 +126,4 @@ static inline void balloon_page_finalize(struct page *page)
> set_page_private(page, 0);
> /* PageOffline is sticky until the page is freed to the buddy. */
> }
> -
> -/*
> - * balloon_page_push - insert a page into a page list.
> - * @head : pointer to list
> - * @page : page to be added
> - *
> - * Caller must ensure the page is private and protect the list.
> - */
> -static inline void balloon_page_push(struct list_head *pages, struct page *page)
> -{
> - list_add(&page->lru, pages);
> -}
> -
> -/*
> - * balloon_page_pop - remove a page from a page list.
> - * @head : pointer to list
> - * @page : page to be added
> - *
> - * Caller must ensure the page is private and protect the list.
> - */
> -static inline struct page *balloon_page_pop(struct list_head *pages)
> -{
> - struct page *page = list_first_entry_or_null(pages, struct page, lru);
> -
> - if (!page)
> - return NULL;
> -
> - list_del(&page->lru);
> - return page;
> -}
> #endif /* _LINUX_BALLOON_COMPACTION_H */
> diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c
> index c44e0b62203cc..90b2d61a593b7 100644
> --- a/mm/balloon_compaction.c
> +++ b/mm/balloon_compaction.c
> @@ -128,9 +128,8 @@ EXPORT_SYMBOL_GPL(balloon_page_alloc);
> * Drivers must call this function to properly enqueue a new allocated balloon
> * page before definitively removing the page from the guest system.
> *
> - * Drivers must not call balloon_page_enqueue on pages that have been pushed to
> - * a list with balloon_page_push before removing them with balloon_page_pop. To
> - * enqueue a list of pages, use balloon_page_list_enqueue instead.
> + * Drivers must not enqueue pages while page->lru is still in
> + * use, and must not use page->lru until a page was unqueued again.
> */
> void balloon_page_enqueue(struct balloon_dev_info *b_dev_info,
> struct page *page)
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 13/23] mm/balloon_compaction: fold balloon_mapping_gfp_mask() into balloon_page_alloc()
2026-01-15 9:20 ` [PATCH v2 13/23] mm/balloon_compaction: fold balloon_mapping_gfp_mask() into balloon_page_alloc() David Hildenbrand (Red Hat)
@ 2026-01-15 12:30 ` Lorenzo Stoakes
0 siblings, 0 replies; 65+ messages in thread
From: Lorenzo Stoakes @ 2026-01-15 12:30 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On Thu, Jan 15, 2026 at 10:20:03AM +0100, David Hildenbrand (Red Hat) wrote:
> Let's just remove balloon_mapping_gfp_mask().
Yeah... this was silly. :)
>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
> include/linux/balloon_compaction.h | 7 -------
> mm/balloon_compaction.c | 12 ++++++++----
> 2 files changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
> index e5451cf1f6589..d1d4739398978 100644
> --- a/include/linux/balloon_compaction.h
> +++ b/include/linux/balloon_compaction.h
> @@ -106,13 +106,6 @@ static inline void balloon_page_insert(struct balloon_dev_info *balloon,
> list_add(&page->lru, &balloon->pages);
> }
>
> -static inline gfp_t balloon_mapping_gfp_mask(void)
> -{
> - if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
> - return GFP_HIGHUSER_MOVABLE;
> - return GFP_HIGHUSER;
> -}
> -
> /*
> * balloon_page_finalize - prepare a balloon page that was removed from the
> * balloon list for release to the page allocator
> diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c
> index 90b2d61a593b7..709c57c00b481 100644
> --- a/mm/balloon_compaction.c
> +++ b/mm/balloon_compaction.c
> @@ -112,10 +112,14 @@ EXPORT_SYMBOL_GPL(balloon_page_list_dequeue);
> */
> struct page *balloon_page_alloc(void)
> {
> - struct page *page = alloc_page(balloon_mapping_gfp_mask() |
> - __GFP_NOMEMALLOC | __GFP_NORETRY |
> - __GFP_NOWARN);
> - return page;
> + gfp_t gfp_flags = __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN;
> +
> + if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
> + gfp_flags |= GFP_HIGHUSER_MOVABLE;
> + else
> + gfp_flags |= GFP_HIGHUSER;
> +
> + return alloc_page(gfp_flags);
> }
> EXPORT_SYMBOL_GPL(balloon_page_alloc);
>
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 14/23] mm/balloon_compaction: move internal helpers to balloon_compaction.c
2026-01-15 9:20 ` [PATCH v2 14/23] mm/balloon_compaction: move internal helpers to balloon_compaction.c David Hildenbrand (Red Hat)
@ 2026-01-15 12:32 ` Lorenzo Stoakes
0 siblings, 0 replies; 65+ messages in thread
From: Lorenzo Stoakes @ 2026-01-15 12:32 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On Thu, Jan 15, 2026 at 10:20:04AM +0100, David Hildenbrand (Red Hat) wrote:
> Let's move the helpers that are not required by drivers anymore.
>
> While at it, drop the doc of balloon_page_device() as it is trivial.
>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
LGTM, with some nits below so:
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
> include/linux/balloon_compaction.h | 44 ------------------------------
> mm/balloon_compaction.c | 38 ++++++++++++++++++++++++++
> 2 files changed, 38 insertions(+), 44 deletions(-)
>
> diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
> index d1d4739398978..eec8994056a44 100644
> --- a/include/linux/balloon_compaction.h
> +++ b/include/linux/balloon_compaction.h
> @@ -75,48 +75,4 @@ static inline void balloon_devinfo_init(struct balloon_dev_info *balloon)
> balloon->migratepage = NULL;
> balloon->adjust_managed_page_count = false;
> }
> -
> -#ifdef CONFIG_BALLOON_COMPACTION
> -/*
> - * balloon_page_device - get the b_dev_info descriptor for the balloon device
> - * that enqueues the given page.
> - */
> -static inline struct balloon_dev_info *balloon_page_device(struct page *page)
> -{
> - return (struct balloon_dev_info *)page_private(page);
> -}
> -#endif /* CONFIG_BALLOON_COMPACTION */
> -
> -/*
> - * balloon_page_insert - insert a page into the balloon's page list and make
> - * the page->private assignment accordingly.
> - * @balloon : pointer to balloon device
> - * @page : page to be assigned as a 'balloon page'
> - *
> - * Caller must ensure the balloon_pages_lock is held.
> - */
> -static inline void balloon_page_insert(struct balloon_dev_info *balloon,
> - struct page *page)
> -{
> - __SetPageOffline(page);
> - if (IS_ENABLED(CONFIG_BALLOON_COMPACTION)) {
> - SetPageMovableOps(page);
> - set_page_private(page, (unsigned long)balloon);
> - }
> - list_add(&page->lru, &balloon->pages);
> -}
> -
> -/*
> - * balloon_page_finalize - prepare a balloon page that was removed from the
> - * balloon list for release to the page allocator
> - * @page: page to be released to the page allocator
> - *
> - * Caller must ensure the balloon_pages_lock is held.
> - */
> -static inline void balloon_page_finalize(struct page *page)
> -{
> - if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
> - set_page_private(page, 0);
> - /* PageOffline is sticky until the page is freed to the buddy. */
> -}
> #endif /* _LINUX_BALLOON_COMPACTION_H */
> diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c
> index 709c57c00b481..717bc43732d09 100644
> --- a/mm/balloon_compaction.c
> +++ b/mm/balloon_compaction.c
> @@ -17,6 +17,44 @@
> */
> static DEFINE_SPINLOCK(balloon_pages_lock);
>
> +static inline struct balloon_dev_info *balloon_page_device(struct page *page)
NIT: inline here isn't needed.
> +{
> + return (struct balloon_dev_info *)page_private(page);
> +}
> +
> +/*
> + * balloon_page_insert - insert a page into the balloon's page list and make
> + * the page->private assignment accordingly.
> + * @balloon : pointer to balloon device
> + * @page : page to be assigned as a 'balloon page'
> + *
> + * Caller must ensure the balloon_pages_lock is held.
> + */
> +static inline void balloon_page_insert(struct balloon_dev_info *balloon,
> + struct page *page)
NIT: same as above.
> +{
> + __SetPageOffline(page);
> + if (IS_ENABLED(CONFIG_BALLOON_COMPACTION)) {
> + SetPageMovableOps(page);
> + set_page_private(page, (unsigned long)balloon);
> + }
> + list_add(&page->lru, &balloon->pages);
> +}
> +
> +/*
> + * balloon_page_finalize - prepare a balloon page that was removed from the
> + * balloon list for release to the page allocator
> + * @page: page to be released to the page allocator
> + *
> + * Caller must ensure the balloon_pages_lock is held.
> + */
> +static inline void balloon_page_finalize(struct page *page)
NIT: same as above.
> +{
> + if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
> + set_page_private(page, 0);
> + /* PageOffline is sticky until the page is freed to the buddy. */
> +}
> +
> static void balloon_page_enqueue_one(struct balloon_dev_info *b_dev_info,
> struct page *page)
> {
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 15/23] mm/balloon_compaction: assert that the balloon_pages_lock is held
2026-01-15 9:20 ` [PATCH v2 15/23] mm/balloon_compaction: assert that the balloon_pages_lock is held David Hildenbrand (Red Hat)
@ 2026-01-15 12:32 ` Lorenzo Stoakes
0 siblings, 0 replies; 65+ messages in thread
From: Lorenzo Stoakes @ 2026-01-15 12:32 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On Thu, Jan 15, 2026 at 10:20:05AM +0100, David Hildenbrand (Red Hat) wrote:
> Let's add some sanity checks for holding the balloon_pages_lock when
> we're effectively inflating/deflating a page.
>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
Seems reasonable to me, so:
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
> mm/balloon_compaction.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c
> index 717bc43732d09..f6e0582bd7ffe 100644
> --- a/mm/balloon_compaction.c
> +++ b/mm/balloon_compaction.c
> @@ -33,6 +33,7 @@ static inline struct balloon_dev_info *balloon_page_device(struct page *page)
> static inline void balloon_page_insert(struct balloon_dev_info *balloon,
> struct page *page)
> {
> + lockdep_assert_held(&balloon_pages_lock);
> __SetPageOffline(page);
> if (IS_ENABLED(CONFIG_BALLOON_COMPACTION)) {
> SetPageMovableOps(page);
> @@ -50,6 +51,7 @@ static inline void balloon_page_insert(struct balloon_dev_info *balloon,
> */
> static inline void balloon_page_finalize(struct page *page)
> {
> + lockdep_assert_held(&balloon_pages_lock);
> if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
> set_page_private(page, 0);
> /* PageOffline is sticky until the page is freed to the buddy. */
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 16/23] mm/balloon_compaction: mark remaining functions for having proper kerneldoc
2026-01-15 9:20 ` [PATCH v2 16/23] mm/balloon_compaction: mark remaining functions for having proper kerneldoc David Hildenbrand (Red Hat)
@ 2026-01-15 12:33 ` Lorenzo Stoakes
0 siblings, 0 replies; 65+ messages in thread
From: Lorenzo Stoakes @ 2026-01-15 12:33 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On Thu, Jan 15, 2026 at 10:20:06AM +0100, David Hildenbrand (Red Hat) wrote:
> Looks like all we are missing for proper kerneldoc is another "*".
Ah nice and easy :) If only it were so easy across the kernel... ;)
>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
> mm/balloon_compaction.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c
> index f6e0582bd7ffe..f41e4a179a431 100644
> --- a/mm/balloon_compaction.c
> +++ b/mm/balloon_compaction.c
> @@ -22,7 +22,7 @@ static inline struct balloon_dev_info *balloon_page_device(struct page *page)
> return (struct balloon_dev_info *)page_private(page);
> }
>
> -/*
> +/**
> * balloon_page_insert - insert a page into the balloon's page list and make
> * the page->private assignment accordingly.
> * @balloon : pointer to balloon device
> @@ -42,7 +42,7 @@ static inline void balloon_page_insert(struct balloon_dev_info *balloon,
> list_add(&page->lru, &balloon->pages);
> }
>
> -/*
> +/**
> * balloon_page_finalize - prepare a balloon page that was removed from the
> * balloon list for release to the page allocator
> * @page: page to be released to the page allocator
> @@ -140,7 +140,7 @@ size_t balloon_page_list_dequeue(struct balloon_dev_info *b_dev_info,
> }
> EXPORT_SYMBOL_GPL(balloon_page_list_dequeue);
>
> -/*
> +/**
> * balloon_page_alloc - allocates a new page for insertion into the balloon
> * page list.
> *
> @@ -163,7 +163,7 @@ struct page *balloon_page_alloc(void)
> }
> EXPORT_SYMBOL_GPL(balloon_page_alloc);
>
> -/*
> +/**
> * balloon_page_enqueue - inserts a new page into the balloon page list.
> *
> * @b_dev_info: balloon device descriptor where we will insert a new page
> @@ -186,7 +186,7 @@ void balloon_page_enqueue(struct balloon_dev_info *b_dev_info,
> }
> EXPORT_SYMBOL_GPL(balloon_page_enqueue);
>
> -/*
> +/**
> * balloon_page_dequeue - removes a page from balloon's page list and returns
> * its address to allow the driver to release the page.
> * @b_dev_info: balloon device descriptor where we will grab a page from.
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 17/23] mm/balloon_compaction: remove "extern" from functions
2026-01-15 9:20 ` [PATCH v2 17/23] mm/balloon_compaction: remove "extern" from functions David Hildenbrand (Red Hat)
@ 2026-01-15 12:34 ` Lorenzo Stoakes
0 siblings, 0 replies; 65+ messages in thread
From: Lorenzo Stoakes @ 2026-01-15 12:34 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On Thu, Jan 15, 2026 at 10:20:07AM +0100, David Hildenbrand (Red Hat) wrote:
> Adding "extern" to functions is frowned-upon. Let's just get rid of it
> for all functions here.
Yes, this is nice thanks!
>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
LGTM so:
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
> include/linux/balloon_compaction.h | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
> index eec8994056a44..7757e0e314fdb 100644
> --- a/include/linux/balloon_compaction.h
> +++ b/include/linux/balloon_compaction.h
> @@ -59,14 +59,14 @@ struct balloon_dev_info {
> bool adjust_managed_page_count;
> };
>
> -extern struct page *balloon_page_alloc(void);
> -extern void balloon_page_enqueue(struct balloon_dev_info *b_dev_info,
> - struct page *page);
> -extern struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info);
> -extern size_t balloon_page_list_enqueue(struct balloon_dev_info *b_dev_info,
> - struct list_head *pages);
> -extern size_t balloon_page_list_dequeue(struct balloon_dev_info *b_dev_info,
> - struct list_head *pages, size_t n_req_pages);
> +struct page *balloon_page_alloc(void);
> +void balloon_page_enqueue(struct balloon_dev_info *b_dev_info,
> + struct page *page);
> +struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info);
> +size_t balloon_page_list_enqueue(struct balloon_dev_info *b_dev_info,
> + struct list_head *pages);
> +size_t balloon_page_list_dequeue(struct balloon_dev_info *b_dev_info,
> + struct list_head *pages, size_t n_req_pages);
>
> static inline void balloon_devinfo_init(struct balloon_dev_info *balloon)
> {
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 04/23] mm/balloon_compaction: centralize basic page migration handling
2026-01-15 12:18 ` Lorenzo Stoakes
@ 2026-01-15 12:57 ` David Hildenbrand (Red Hat)
0 siblings, 0 replies; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 12:57 UTC (permalink / raw)
To: Lorenzo Stoakes
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
>> #endif /* CONFIG_BALLOON_COMPACTION */
>> diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c
>> index 03c5dbabb1565..5444c61bb9e76 100644
>> --- a/mm/balloon_compaction.c
>> +++ b/mm/balloon_compaction.c
>> @@ -232,20 +232,49 @@ static void balloon_page_putback(struct page *page)
>> spin_unlock_irqrestore(&b_dev_info->pages_lock, flags);
>> }
>>
>> -/* move_to_new_page() counterpart for a ballooned page */
>> static int balloon_page_migrate(struct page *newpage, struct page *page,
>> enum migrate_mode mode)
>
> I honestly wonder if page should be 'oldpage', or rather we should just match
> args to the struct movable_operations e.g. dst, src?
Yeah, likely it should be made consistent. But not as part of this patch
series :)
In particular, as we should be making all other things, like
balloon_dev_info's migratepage and the ones implementing it use the same
terminology in the same go.
On the TODO list.
>
>> {
>> - struct balloon_dev_info *balloon = balloon_page_device(page);
>> + struct balloon_dev_info *b_dev_info = balloon_page_device(page);
>> + unsigned long flags;
>> + int rc;
>>
>> VM_BUG_ON_PAGE(!PageLocked(page), page);
>> VM_BUG_ON_PAGE(!PageLocked(newpage), newpage);
>>
>> /* Isolated balloon pages cannot get deflated. */
>
> Hmm, I'm a bit confused by this comment, isn't 'page' isolated?
>
> This comment reads like !b_dev_info implies page isolated and thus a
> WARN_ON_ONCE() issue, but later you say 'Free the now-deflated page we isolated
> in balloon_page_isolate().' in reference to page?
The page is isolated, as documented for "struct movable_operations". And
as the comment states, isolated pages cannot deflate.
So consequently, if we reach this point, we still have a balloon device,
because the balloon device could not have deflated the page.
I don't really want to change the comment as part of this change here,
it logically does not belong into this patch.
Maybe something for a cleanup patch:
"When we isolated the page, the page was inflated in a balloon device.
As isolated balloon pages cannot get deflated, we still have a balloon
device here."
>
> So both can't be true.
>
>> - if (WARN_ON_ONCE(!balloon))
>> + if (WARN_ON_ONCE(!b_dev_info))
>> return -EAGAIN;
>>
>> - return balloon->migratepage(balloon, newpage, page, mode);
>> + rc = b_dev_info->migratepage(b_dev_info, newpage, page, mode);
>> + switch (rc) {
>> + case 0:
>> + spin_lock_irqsave(&b_dev_info->pages_lock, flags);
>> +
>> + /* Insert the new page into the balloon list. */
>
> Slightly weird to put this comment next to the pageref update then a newline
> hten the actual insertion bit.
When a page is in the list we have to grab a reference. No strong
opinion about dropping the newline.
>
>> + get_page(newpage);
>> +
>> + balloon_page_insert(b_dev_info, newpage);
>> + __count_vm_event(BALLOON_MIGRATE);
>> + break;
>> + case -ENOENT:
>> + spin_lock_irqsave(&b_dev_info->pages_lock, flags);
>> +
>> + /* Old page was deflated but new page not inflated. */
>
> Weird reference to old page and new page when old page is 'page', with dst, src
> we could just say destination/source?
I can strip the "Old" for now, but dst vs. src will be handled separately.
>
>> + __count_vm_event(BALLOON_DEFLATE);
>> + break;
>> + default:
>> + return rc;
>
> Don't we need to change the isolate stats etc. if we simply fail here? Or does
> the movable ops logic correctly handle this for us?
A non-0 return value from balloon_page_migrate() means that migration
failed and that the (src) page stays isolated.
For example, migration core can later retry migration without re-isolation.
So the migration-core takes care of this.
>
> Ah I guess baloon_page_putback() would be invoked :) Fun!
Right, the isolated page has to be putback later.
>
>> + }
>
> It's subjective and pedantic but I don't love this use of the switch here, it
> really makes it seem like 'just another case' to do the _key_ action here of
> migrating a balloon page. Also could compress things a bit, that's even more
> subjective :)
You summarized my thoughts well ;)
I had exactly the thing you write below before I converted to switch. I
didn't particularly like the filtering for return codes. Let me think
about whether I want to go back.
As you note, it's highly subjective.
[...]
>
>> +
>> + b_dev_info->isolated_pages--;
>> + spin_unlock_irqrestore(&b_dev_info->pages_lock, flags);
>> +
>> + /* Free the now-deflated page we isolated in balloon_page_isolate(). */
>> + balloon_page_finalize(page);
>> + put_page(page);
>
> OK so we get on migrate, but put the source page which would have got gotten
> previously I guess?
Right, the (old)/page source was deflated, so we prepare for handing it
back to the buddy.
In the future, once these pages are frozen, migration-core will likely
take care of doing the freeing, instead of us doing the put_page() here.
One goal of this patch set was to move the getting/putting of pages out
as far as possible, such that the return values from
isolate/migrate/putback later on indicate who now "owns" the reference
to the frozen page.
Thanks for the review!
--
Cheers
David
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 18/23] mm/vmscan: drop inclusion of balloon_compaction.h
2026-01-15 9:20 ` [PATCH v2 18/23] mm/vmscan: drop inclusion of balloon_compaction.h David Hildenbrand (Red Hat)
@ 2026-01-15 13:42 ` Lorenzo Stoakes
0 siblings, 0 replies; 65+ messages in thread
From: Lorenzo Stoakes @ 2026-01-15 13:42 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On Thu, Jan 15, 2026 at 10:20:08AM +0100, David Hildenbrand (Red Hat) wrote:
> Before commit b1123ea6d3b3 ("mm: balloon: use general non-lru movable page
> feature"), the include was required because of isolated_balloon_page().
>
> It's no longer required, so let's remove it.
>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
Seems sensible so:
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
> mm/vmscan.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index a0e3f51de749e..cd9f9a779e89b 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -63,7 +63,6 @@
> #include <asm/div64.h>
>
> #include <linux/swapops.h>
> -#include <linux/balloon_compaction.h>
> #include <linux/sched/sysctl.h>
>
> #include "internal.h"
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 19/23] mm: rename balloon_compaction.(c|h) to balloon.(c|h)
2026-01-15 9:20 ` [PATCH v2 19/23] mm: rename balloon_compaction.(c|h) to balloon.(c|h) David Hildenbrand (Red Hat)
@ 2026-01-15 13:45 ` Lorenzo Stoakes
0 siblings, 0 replies; 65+ messages in thread
From: Lorenzo Stoakes @ 2026-01-15 13:45 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On Thu, Jan 15, 2026 at 10:20:09AM +0100, David Hildenbrand (Red Hat) wrote:
> Even without CONFIG_BALLOON_COMPACTION this infrastructure implements
> basic list and page management for a memory balloon.
>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
Seems sensible so:
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
> Documentation/core-api/mm-api.rst | 2 +-
> MAINTAINERS | 4 ++--
> arch/powerpc/platforms/pseries/cmm.c | 2 +-
> drivers/misc/vmw_balloon.c | 2 +-
> drivers/virtio/virtio_balloon.c | 2 +-
> include/linux/{balloon_compaction.h => balloon.h} | 11 +++++------
> mm/Makefile | 2 +-
> mm/{balloon_compaction.c => balloon.c} | 7 +++----
> 8 files changed, 15 insertions(+), 17 deletions(-)
> rename include/linux/{balloon_compaction.h => balloon.h} (92%)
> rename mm/{balloon_compaction.c => balloon.c} (98%)
>
> diff --git a/Documentation/core-api/mm-api.rst b/Documentation/core-api/mm-api.rst
> index 68193a4cfcf52..aabdd3cba58e8 100644
> --- a/Documentation/core-api/mm-api.rst
> +++ b/Documentation/core-api/mm-api.rst
> @@ -130,5 +130,5 @@ More Memory Management Functions
> .. kernel-doc:: mm/vmscan.c
> .. kernel-doc:: mm/memory_hotplug.c
> .. kernel-doc:: mm/mmu_notifier.c
> -.. kernel-doc:: mm/balloon_compaction.c
> +.. kernel-doc:: mm/balloon.c
> .. kernel-doc:: mm/huge_memory.c
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 0d044a58cbfe0..de8f89ca1149f 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -27536,9 +27536,9 @@ M: David Hildenbrand <david@kernel.org>
> L: virtualization@lists.linux.dev
> S: Maintained
> F: drivers/virtio/virtio_balloon.c
> -F: include/linux/balloon_compaction.h
> +F: include/linux/balloon.h
> F: include/uapi/linux/virtio_balloon.h
> -F: mm/balloon_compaction.c
> +F: mm/balloon.c
>
> VIRTIO BLOCK AND SCSI DRIVERS
> M: "Michael S. Tsirkin" <mst@redhat.com>
> diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
> index 7fd8b3d7e7637..7a3c4922685ab 100644
> --- a/arch/powerpc/platforms/pseries/cmm.c
> +++ b/arch/powerpc/platforms/pseries/cmm.c
> @@ -19,7 +19,7 @@
> #include <linux/stringify.h>
> #include <linux/swap.h>
> #include <linux/device.h>
> -#include <linux/balloon_compaction.h>
> +#include <linux/balloon.h>
> #include <asm/firmware.h>
> #include <asm/hvcall.h>
> #include <asm/mmu.h>
> diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
> index 53e9335b6718c..7fd3f709108c2 100644
> --- a/drivers/misc/vmw_balloon.c
> +++ b/drivers/misc/vmw_balloon.c
> @@ -29,7 +29,7 @@
> #include <linux/rwsem.h>
> #include <linux/slab.h>
> #include <linux/spinlock.h>
> -#include <linux/balloon_compaction.h>
> +#include <linux/balloon.h>
> #include <linux/vmw_vmci_defs.h>
> #include <linux/vmw_vmci_api.h>
> #include <asm/hypervisor.h>
> diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> index 6ae00de78b61b..de8041c3285a1 100644
> --- a/drivers/virtio/virtio_balloon.c
> +++ b/drivers/virtio/virtio_balloon.c
> @@ -13,7 +13,7 @@
> #include <linux/delay.h>
> #include <linux/slab.h>
> #include <linux/module.h>
> -#include <linux/balloon_compaction.h>
> +#include <linux/balloon.h>
> #include <linux/oom.h>
> #include <linux/wait.h>
> #include <linux/mm.h>
> diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon.h
> similarity index 92%
> rename from include/linux/balloon_compaction.h
> rename to include/linux/balloon.h
> index 7757e0e314fdb..82585542300d6 100644
> --- a/include/linux/balloon_compaction.h
> +++ b/include/linux/balloon.h
> @@ -1,8 +1,7 @@
> /* SPDX-License-Identifier: GPL-2.0 */
> /*
> - * include/linux/balloon_compaction.h
> - *
> - * Common interface definitions for making balloon pages movable by compaction.
> + * Common interface for implementing a memory balloon, including support
> + * for migration of pages inflated in a memory balloon.
> *
> * Balloon page migration makes use of the general "movable_ops page migration"
> * feature.
> @@ -35,8 +34,8 @@
> *
> * Copyright (C) 2012, Red Hat, Inc. Rafael Aquini <aquini@redhat.com>
> */
> -#ifndef _LINUX_BALLOON_COMPACTION_H
> -#define _LINUX_BALLOON_COMPACTION_H
> +#ifndef _LINUX_BALLOON_H
> +#define _LINUX_BALLOON_H
> #include <linux/pagemap.h>
> #include <linux/page-flags.h>
> #include <linux/migrate.h>
> @@ -75,4 +74,4 @@ static inline void balloon_devinfo_init(struct balloon_dev_info *balloon)
> balloon->migratepage = NULL;
> balloon->adjust_managed_page_count = false;
> }
> -#endif /* _LINUX_BALLOON_COMPACTION_H */
> +#endif /* _LINUX_BALLOON_H */
> diff --git a/mm/Makefile b/mm/Makefile
> index 9175f8cc65658..1e31e0a528dc1 100644
> --- a/mm/Makefile
> +++ b/mm/Makefile
> @@ -122,7 +122,7 @@ obj-$(CONFIG_CMA) += cma.o
> obj-$(CONFIG_NUMA) += numa.o
> obj-$(CONFIG_NUMA_MEMBLKS) += numa_memblks.o
> obj-$(CONFIG_NUMA_EMU) += numa_emulation.o
> -obj-$(CONFIG_MEMORY_BALLOON) += balloon_compaction.o
> +obj-$(CONFIG_MEMORY_BALLOON) += balloon.o
> obj-$(CONFIG_PAGE_EXTENSION) += page_ext.o
> obj-$(CONFIG_PAGE_TABLE_CHECK) += page_table_check.o
> obj-$(CONFIG_CMA_DEBUGFS) += cma_debug.o
> diff --git a/mm/balloon_compaction.c b/mm/balloon.c
> similarity index 98%
> rename from mm/balloon_compaction.c
> rename to mm/balloon.c
> index f41e4a179a431..5734dae81e318 100644
> --- a/mm/balloon_compaction.c
> +++ b/mm/balloon.c
> @@ -1,15 +1,14 @@
> // SPDX-License-Identifier: GPL-2.0-only
> /*
> - * mm/balloon_compaction.c
> - *
> - * Common interface for making balloon pages movable by compaction.
> + * Common interface for implementing a memory balloon, including support
> + * for migration of pages inflated in a memory balloon.
> *
> * Copyright (C) 2012, Red Hat, Inc. Rafael Aquini <aquini@redhat.com>
> */
> #include <linux/mm.h>
> #include <linux/slab.h>
> #include <linux/export.h>
> -#include <linux/balloon_compaction.h>
> +#include <linux/balloon.h>
>
> /*
> * Lock protecting the balloon_dev_info of all devices. We don't really
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 20/23] mm/kconfig: make BALLOON_COMPACTION depend on MIGRATION
2026-01-15 9:20 ` [PATCH v2 20/23] mm/kconfig: make BALLOON_COMPACTION depend on MIGRATION David Hildenbrand (Red Hat)
@ 2026-01-15 13:47 ` Lorenzo Stoakes
0 siblings, 0 replies; 65+ messages in thread
From: Lorenzo Stoakes @ 2026-01-15 13:47 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On Thu, Jan 15, 2026 at 10:20:10AM +0100, David Hildenbrand (Red Hat) wrote:
> Migration support for balloon memory depends on MIGRATION not
> COMPACTION. Compaction is simply another user of page migration.
>
> The last dependency on compaction.c was effectively removed with
> commit 3d388584d599 ("mm: convert "movable" flag in page->mapping to a
> page flag"). Ever since, everything for handling movable_ops page
> migration resides in core migration code.
>
> So let's change the dependency and adjust the description +
> help text.
>
> We'll rename BALLOON_COMPACTION separately next.
>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
Far pithier also. LGTM so:
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
> mm/Kconfig | 17 +++++++----------
> 1 file changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/mm/Kconfig b/mm/Kconfig
> index 24a3ff149a1b0..0d13c1b36e1c1 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -599,17 +599,14 @@ config MEMORY_BALLOON
> #
> # support for memory balloon compaction
> config BALLOON_COMPACTION
> - bool "Allow for balloon memory compaction/migration"
> + bool "Allow for balloon memory migration"
> default y
> - depends on COMPACTION && MEMORY_BALLOON
> - help
> - Memory fragmentation introduced by ballooning might reduce
> - significantly the number of 2MB contiguous memory blocks that can be
> - used within a guest, thus imposing performance penalties associated
> - with the reduced number of transparent huge pages that could be used
> - by the guest workload. Allowing the compaction & migration for memory
> - pages enlisted as being part of memory balloon devices avoids the
> - scenario aforementioned and helps improving memory defragmentation.
> + depends on MIGRATION && MEMORY_BALLOON
> + help
> + Allow for migration of pages inflated in a memory balloon such that
> + they can be allocated from memory areas only available for movable
> + allocations (e.g., ZONE_MOVABLE, CMA) and such that they can be
> + migrated for memory defragmentation purposes by memory compaction.
>
> #
> # support for memory compaction
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 21/23] mm: rename CONFIG_BALLOON_COMPACTION to CONFIG_BALLOON_MIGRATION
2026-01-15 9:20 ` [PATCH v2 21/23] mm: rename CONFIG_BALLOON_COMPACTION to CONFIG_BALLOON_MIGRATION David Hildenbrand (Red Hat)
@ 2026-01-15 13:52 ` Lorenzo Stoakes
0 siblings, 0 replies; 65+ messages in thread
From: Lorenzo Stoakes @ 2026-01-15 13:52 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On Thu, Jan 15, 2026 at 10:20:11AM +0100, David Hildenbrand (Red Hat) wrote:
> While compaction depends on migration, the other direction is not the
> case. So let's make it clearer that this is all about migration of
> balloon pages.
>
> Adjust all comments/docs in the core to talk about "migration" instead
> of "compaction".
Saw:
include/linux/balloon.h:25: * performing balloon page compaction. In order to sort out these racy scenarios
include/linux/balloon.h:26: * and safely perform balloon's page compaction and migration we must, always,
Documentation/mm/page_migration.rst:175:balloon-compaction infrastructure residing in the core kernel.
At this commit so maybe a few more to chase up?
>
> While at it add some "/* CONFIG_BALLOON_MIGRATION */".
>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
Otherwise LGTM, so:
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
> Documentation/admin-guide/mm/memory-hotplug.rst | 8 ++++----
> arch/powerpc/platforms/pseries/cmm.c | 8 ++++----
> drivers/misc/vmw_balloon.c | 8 ++++----
> drivers/virtio/virtio_balloon.c | 6 +++---
> include/linux/balloon.h | 2 +-
> include/linux/vm_event_item.h | 4 ++--
> mm/Kconfig | 4 ++--
> mm/balloon.c | 10 +++++-----
> mm/memory_hotplug.c | 4 ++--
> mm/migrate.c | 2 +-
> mm/vmstat.c | 4 ++--
> 11 files changed, 30 insertions(+), 30 deletions(-)
>
> diff --git a/Documentation/admin-guide/mm/memory-hotplug.rst b/Documentation/admin-guide/mm/memory-hotplug.rst
> index 6581558fd0d7a..0207f87251421 100644
> --- a/Documentation/admin-guide/mm/memory-hotplug.rst
> +++ b/Documentation/admin-guide/mm/memory-hotplug.rst
> @@ -603,11 +603,11 @@ ZONE_MOVABLE, especially when fine-tuning zone ratios:
> memory for metadata and page tables in the direct map; having a lot of offline
> memory blocks is not a typical case, though.
>
> -- Memory ballooning without balloon compaction is incompatible with
> - ZONE_MOVABLE. Only some implementations, such as virtio-balloon and
> - pseries CMM, fully support balloon compaction.
> +- Memory ballooning without support for balloon memory migration is incompatible
> + with ZONE_MOVABLE. Only some implementations, such as virtio-balloon and
> + pseries CMM, fully support balloon memory migration.
>
> - Further, the CONFIG_BALLOON_COMPACTION kernel configuration option might be
> + Further, the CONFIG_BALLOON_MIGRATION kernel configuration option might be
> disabled. In that case, balloon inflation will only perform unmovable
> allocations and silently create a zone imbalance, usually triggered by
> inflation requests from the hypervisor.
> diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
> index 7a3c4922685ab..8d83df12430f2 100644
> --- a/arch/powerpc/platforms/pseries/cmm.c
> +++ b/arch/powerpc/platforms/pseries/cmm.c
> @@ -494,7 +494,7 @@ static struct notifier_block cmm_mem_nb = {
> .priority = CMM_MEM_HOTPLUG_PRI
> };
>
> -#ifdef CONFIG_BALLOON_COMPACTION
> +#ifdef CONFIG_BALLOON_MIGRATION
> static int cmm_migratepage(struct balloon_dev_info *b_dev_info,
> struct page *newpage, struct page *page,
> enum migrate_mode mode)
> @@ -520,10 +520,10 @@ static int cmm_migratepage(struct balloon_dev_info *b_dev_info,
> plpar_page_set_active(page);
> return 0;
> }
> -#else /* CONFIG_BALLOON_COMPACTION */
> +#else /* CONFIG_BALLOON_MIGRATION */
> int cmm_migratepage(struct balloon_dev_info *b_dev_info, struct page *newpage,
> struct page *page, enum migrate_mode mode);
> -#endif /* CONFIG_BALLOON_COMPACTION */
> +#endif /* CONFIG_BALLOON_MIGRATION */
>
> /**
> * cmm_init - Module initialization
> @@ -540,7 +540,7 @@ static int cmm_init(void)
>
> balloon_devinfo_init(&b_dev_info);
> b_dev_info.adjust_managed_page_count = true;
> - if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
> + if (IS_ENABLED(CONFIG_BALLOON_MIGRATION))
> b_dev_info.migratepage = cmm_migratepage;
>
> rc = register_oom_notifier(&cmm_oom_nb);
> diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c
> index 7fd3f709108c2..216a163959684 100644
> --- a/drivers/misc/vmw_balloon.c
> +++ b/drivers/misc/vmw_balloon.c
> @@ -1719,7 +1719,7 @@ static inline void vmballoon_debugfs_exit(struct vmballoon *b)
> #endif /* CONFIG_DEBUG_FS */
>
>
> -#ifdef CONFIG_BALLOON_COMPACTION
> +#ifdef CONFIG_BALLOON_MIGRATION
> /**
> * vmballoon_migratepage() - migrates a balloon page.
> * @b_dev_info: balloon device information descriptor.
> @@ -1803,11 +1803,11 @@ static int vmballoon_migratepage(struct balloon_dev_info *b_dev_info,
> up_read(&b->conf_sem);
> return ret;
> }
> -#else /* CONFIG_BALLOON_COMPACTION */
> +#else /* CONFIG_BALLOON_MIGRATION */
> int vmballoon_migratepage(struct balloon_dev_info *b_dev_info,
> struct page *newpage, struct page *page,
> enum migrate_mode mode);
> -#endif /* CONFIG_BALLOON_COMPACTION */
> +#endif /* CONFIG_BALLOON_MIGRATION */
>
> static int __init vmballoon_init(void)
> {
> @@ -1827,7 +1827,7 @@ static int __init vmballoon_init(void)
> return error;
>
> balloon_devinfo_init(&balloon.b_dev_info);
> - if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
> + if (IS_ENABLED(CONFIG_BALLOON_MIGRATION))
> balloon.b_dev_info.migratepage = vmballoon_migratepage;
>
> INIT_LIST_HEAD(&balloon.huge_pages);
> diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> index de8041c3285a1..4e549abe59ff1 100644
> --- a/drivers/virtio/virtio_balloon.c
> +++ b/drivers/virtio/virtio_balloon.c
> @@ -802,7 +802,7 @@ static void report_free_page_func(struct work_struct *work)
> }
> }
>
> -#ifdef CONFIG_BALLOON_COMPACTION
> +#ifdef CONFIG_BALLOON_MIGRATION
> /*
> * virtballoon_migratepage - perform the balloon page migration on behalf of
> * a compaction thread. (called under page lock)
> @@ -851,7 +851,7 @@ static int virtballoon_migratepage(struct balloon_dev_info *vb_dev_info,
> mutex_unlock(&vb->balloon_lock);
> return 0;
> }
> -#endif /* CONFIG_BALLOON_COMPACTION */
> +#endif /* CONFIG_BALLOON_MIGRATION */
>
> static unsigned long shrink_free_pages(struct virtio_balloon *vb,
> unsigned long pages_to_free)
> @@ -948,7 +948,7 @@ static int virtballoon_probe(struct virtio_device *vdev)
>
> if (!virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
> vb->vb_dev_info.adjust_managed_page_count = true;
> -#ifdef CONFIG_BALLOON_COMPACTION
> +#ifdef CONFIG_BALLOON_MIGRATION
> vb->vb_dev_info.migratepage = virtballoon_migratepage;
> #endif
> if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_FREE_PAGE_HINT)) {
> diff --git a/include/linux/balloon.h b/include/linux/balloon.h
> index 82585542300d6..e8da95ca4ad48 100644
> --- a/include/linux/balloon.h
> +++ b/include/linux/balloon.h
> @@ -45,7 +45,7 @@
>
> /*
> * Balloon device information descriptor.
> - * This struct is used to allow the common balloon compaction interface
> + * This struct is used to allow the common balloon page migration interface
> * procedures to find the proper balloon device holding memory pages they'll
> * have to cope for page compaction / migration, as well as it serves the
> * balloon driver as a page book-keeper for its registered balloon devices.
> diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
> index 92f80b4d69a6d..fca34d3473b6b 100644
> --- a/include/linux/vm_event_item.h
> +++ b/include/linux/vm_event_item.h
> @@ -125,9 +125,9 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
> #ifdef CONFIG_MEMORY_BALLOON
> BALLOON_INFLATE,
> BALLOON_DEFLATE,
> -#ifdef CONFIG_BALLOON_COMPACTION
> +#ifdef CONFIG_BALLOON_MIGRATION
> BALLOON_MIGRATE,
> -#endif
> +#endif /* CONFIG_BALLOON_MIGRATION */
> #endif
> #ifdef CONFIG_DEBUG_TLBFLUSH
> NR_TLB_REMOTE_FLUSH, /* cpu tried to flush others' tlbs */
> diff --git a/mm/Kconfig b/mm/Kconfig
> index 0d13c1b36e1c1..460a148d5b71a 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -597,8 +597,8 @@ config MEMORY_BALLOON
> bool
>
> #
> -# support for memory balloon compaction
> -config BALLOON_COMPACTION
> +# support for memory balloon page migration
> +config BALLOON_MIGRATION
> bool "Allow for balloon memory migration"
> default y
> depends on MIGRATION && MEMORY_BALLOON
> diff --git a/mm/balloon.c b/mm/balloon.c
> index 5734dae81e318..8a21c6b9a7f0a 100644
> --- a/mm/balloon.c
> +++ b/mm/balloon.c
> @@ -34,7 +34,7 @@ static inline void balloon_page_insert(struct balloon_dev_info *balloon,
> {
> lockdep_assert_held(&balloon_pages_lock);
> __SetPageOffline(page);
> - if (IS_ENABLED(CONFIG_BALLOON_COMPACTION)) {
> + if (IS_ENABLED(CONFIG_BALLOON_MIGRATION)) {
> SetPageMovableOps(page);
> set_page_private(page, (unsigned long)balloon);
> }
> @@ -51,7 +51,7 @@ static inline void balloon_page_insert(struct balloon_dev_info *balloon,
> static inline void balloon_page_finalize(struct page *page)
> {
> lockdep_assert_held(&balloon_pages_lock);
> - if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
> + if (IS_ENABLED(CONFIG_BALLOON_MIGRATION))
> set_page_private(page, 0);
> /* PageOffline is sticky until the page is freed to the buddy. */
> }
> @@ -153,7 +153,7 @@ struct page *balloon_page_alloc(void)
> {
> gfp_t gfp_flags = __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN;
>
> - if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
> + if (IS_ENABLED(CONFIG_BALLOON_MIGRATION))
> gfp_flags |= GFP_HIGHUSER_MOVABLE;
> else
> gfp_flags |= GFP_HIGHUSER;
> @@ -232,7 +232,7 @@ struct page *balloon_page_dequeue(struct balloon_dev_info *b_dev_info)
> }
> EXPORT_SYMBOL_GPL(balloon_page_dequeue);
>
> -#ifdef CONFIG_BALLOON_COMPACTION
> +#ifdef CONFIG_BALLOON_MIGRATION
>
> static bool balloon_page_isolate(struct page *page, isolate_mode_t mode)
>
> @@ -340,4 +340,4 @@ static int __init balloon_init(void)
> }
> core_initcall(balloon_init);
>
> -#endif /* CONFIG_BALLOON_COMPACTION */
> +#endif /* CONFIG_BALLOON_MIGRATION */
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 389989a28abe0..bc805029da517 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -946,8 +946,8 @@ static struct zone *default_kernel_zone_for_pfn(int nid, unsigned long start_pfn
> * We rely on "present pages" instead of "managed pages", as the latter is
> * highly unreliable and dynamic in virtualized environments, and does not
> * consider boot time allocations. For example, memory ballooning adjusts the
> - * managed pages when inflating/deflating the balloon, and balloon compaction
> - * can even migrate inflated pages between zones.
> + * managed pages when inflating/deflating the balloon, and balloon page
> + * migration can even migrate inflated pages between zones.
> *
> * Using "present pages" is better but some things to keep in mind are:
> *
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 4750a2ba15fef..1bf2cf8c44dd4 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -88,7 +88,7 @@ static const struct movable_operations *page_movable_ops(struct page *page)
> * back to the buddy.
> */
> if (PageOffline(page))
> - /* Only balloon compaction sets PageOffline pages movable. */
> + /* Only balloon page migration sets PageOffline pages movable. */
> return offline_movable_ops;
> if (PageZsmalloc(page))
> return zsmalloc_movable_ops;
> diff --git a/mm/vmstat.c b/mm/vmstat.c
> index 6ae8891c9693e..e96a344ab5974 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -1422,9 +1422,9 @@ const char * const vmstat_text[] = {
> #ifdef CONFIG_MEMORY_BALLOON
> [I(BALLOON_INFLATE)] = "balloon_inflate",
> [I(BALLOON_DEFLATE)] = "balloon_deflate",
> -#ifdef CONFIG_BALLOON_COMPACTION
> +#ifdef CONFIG_BALLOON_MIGRATION
> [I(BALLOON_MIGRATE)] = "balloon_migrate",
> -#endif
> +#endif /* CONFIG_BALLOON_MIGRATION */
> #endif /* CONFIG_MEMORY_BALLOON */
> #ifdef CONFIG_DEBUG_TLBFLUSH
> [I(NR_TLB_REMOTE_FLUSH)] = "nr_tlb_remote_flush",
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 22/23] mm: rename CONFIG_MEMORY_BALLOON -> CONFIG_BALLOON
2026-01-15 9:20 ` [PATCH v2 22/23] mm: rename CONFIG_MEMORY_BALLOON -> CONFIG_BALLOON David Hildenbrand (Red Hat)
@ 2026-01-15 13:55 ` Lorenzo Stoakes
2026-01-15 16:33 ` David Hildenbrand (Red Hat)
0 siblings, 1 reply; 65+ messages in thread
From: Lorenzo Stoakes @ 2026-01-15 13:55 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On Thu, Jan 15, 2026 at 10:20:12AM +0100, David Hildenbrand (Red Hat) wrote:
> Let's make it consistent with the naming of the files but also with the
> naming of CONFIG_BALLOON_MIGRATION.
>
> While at it, add a "/* CONFIG_BALLOON */".
Probably not relevant but cheap for me to share :) so grepped for
'memory_balloon' and saw:
include/uapi/linux/virtio_ids.h
44:#define VIRTIO_ID_MEMORY_BALLOON 13 /* virtio memory balloon */
This maybe relevant (I guess this isn't actually used anywhere?) though
interesting there is also VIRTIO_ID_BALLOON... hmm :)
The below doesn't look relevant at all.
drivers/virt/vboxguest/vmmdev.h
326:#define VMMDEV_MEMORY_BALLOON_CHUNK_SIZE (1048576)
327:#define VMMDEV_MEMORY_BALLOON_CHUNK_PAGES (1048576 / 4096)
355: u64 phys_page[VMMDEV_MEMORY_BALLOON_CHUNK_PAGES];
drivers/virt/vboxguest/vboxguest_core.c
278: pages = kmalloc_array(VMMDEV_MEMORY_BALLOON_CHUNK_PAGES,
286: req->pages = VMMDEV_MEMORY_BALLOON_CHUNK_PAGES;
288: for (i = 0; i < VMMDEV_MEMORY_BALLOON_CHUNK_PAGES; i++) {
333: req->pages = VMMDEV_MEMORY_BALLOON_CHUNK_PAGES;
335: for (i = 0; i < VMMDEV_MEMORY_BALLOON_CHUNK_PAGES; i++)
344: for (i = 0; i < VMMDEV_MEMORY_BALLOON_CHUNK_PAGES; i++)
>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
Otherwise LGTM, so:
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
> arch/powerpc/platforms/pseries/Kconfig | 2 +-
> drivers/misc/Kconfig | 2 +-
> drivers/virtio/Kconfig | 2 +-
> include/linux/vm_event_item.h | 4 ++--
> mm/Kconfig | 4 ++--
> mm/Makefile | 2 +-
> mm/vmstat.c | 4 ++--
> 7 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
> index 3e042218d6cd8..f7052b131a4c5 100644
> --- a/arch/powerpc/platforms/pseries/Kconfig
> +++ b/arch/powerpc/platforms/pseries/Kconfig
> @@ -120,7 +120,7 @@ config PPC_SMLPAR
> config CMM
> tristate "Collaborative memory management"
> depends on PPC_SMLPAR
> - select MEMORY_BALLOON
> + select BALLOON
> default y
> help
> Select this option, if you want to enable the kernel interface
> diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
> index d7d41b054b982..5cc79d1517af5 100644
> --- a/drivers/misc/Kconfig
> +++ b/drivers/misc/Kconfig
> @@ -410,7 +410,7 @@ config DS1682
> config VMWARE_BALLOON
> tristate "VMware Balloon Driver"
> depends on VMWARE_VMCI && X86 && HYPERVISOR_GUEST
> - select MEMORY_BALLOON
> + select BALLOON
> help
> This is VMware physical memory management driver which acts
> like a "balloon" that can be inflated to reclaim physical pages
> diff --git a/drivers/virtio/Kconfig b/drivers/virtio/Kconfig
> index 6db5235a7693d..ce5bc0d9ea287 100644
> --- a/drivers/virtio/Kconfig
> +++ b/drivers/virtio/Kconfig
> @@ -112,7 +112,7 @@ config VIRTIO_PMEM
> config VIRTIO_BALLOON
> tristate "Virtio balloon driver"
> depends on VIRTIO
> - select MEMORY_BALLOON
> + select BALLOON
> select PAGE_REPORTING
> help
> This driver supports increasing and decreasing the amount
> diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h
> index fca34d3473b6b..22a139f82d75f 100644
> --- a/include/linux/vm_event_item.h
> +++ b/include/linux/vm_event_item.h
> @@ -122,13 +122,13 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
> THP_SWPOUT,
> THP_SWPOUT_FALLBACK,
> #endif
> -#ifdef CONFIG_MEMORY_BALLOON
> +#ifdef CONFIG_BALLOON
> BALLOON_INFLATE,
> BALLOON_DEFLATE,
> #ifdef CONFIG_BALLOON_MIGRATION
> BALLOON_MIGRATE,
> #endif /* CONFIG_BALLOON_MIGRATION */
> -#endif
> +#endif /* CONFIG_BALLOON */
> #ifdef CONFIG_DEBUG_TLBFLUSH
> NR_TLB_REMOTE_FLUSH, /* cpu tried to flush others' tlbs */
> NR_TLB_REMOTE_FLUSH_RECEIVED,/* cpu received ipi for flush */
> diff --git a/mm/Kconfig b/mm/Kconfig
> index 460a148d5b71a..8e23af521605e 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -593,7 +593,7 @@ config SPLIT_PMD_PTLOCKS
>
> #
> # support for memory balloon
> -config MEMORY_BALLOON
> +config BALLOON
> bool
>
> #
> @@ -601,7 +601,7 @@ config MEMORY_BALLOON
> config BALLOON_MIGRATION
> bool "Allow for balloon memory migration"
> default y
> - depends on MIGRATION && MEMORY_BALLOON
> + depends on MIGRATION && BALLOON
> help
> Allow for migration of pages inflated in a memory balloon such that
> they can be allocated from memory areas only available for movable
> diff --git a/mm/Makefile b/mm/Makefile
> index 1e31e0a528dc1..0d85b10dbdde4 100644
> --- a/mm/Makefile
> +++ b/mm/Makefile
> @@ -122,7 +122,7 @@ obj-$(CONFIG_CMA) += cma.o
> obj-$(CONFIG_NUMA) += numa.o
> obj-$(CONFIG_NUMA_MEMBLKS) += numa_memblks.o
> obj-$(CONFIG_NUMA_EMU) += numa_emulation.o
> -obj-$(CONFIG_MEMORY_BALLOON) += balloon.o
> +obj-$(CONFIG_BALLOON) += balloon.o
> obj-$(CONFIG_PAGE_EXTENSION) += page_ext.o
> obj-$(CONFIG_PAGE_TABLE_CHECK) += page_table_check.o
> obj-$(CONFIG_CMA_DEBUGFS) += cma_debug.o
> diff --git a/mm/vmstat.c b/mm/vmstat.c
> index e96a344ab5974..0f64c898f79f8 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -1419,13 +1419,13 @@ const char * const vmstat_text[] = {
> [I(THP_SWPOUT)] = "thp_swpout",
> [I(THP_SWPOUT_FALLBACK)] = "thp_swpout_fallback",
> #endif
> -#ifdef CONFIG_MEMORY_BALLOON
> +#ifdef CONFIG_BALLOON
> [I(BALLOON_INFLATE)] = "balloon_inflate",
> [I(BALLOON_DEFLATE)] = "balloon_deflate",
> #ifdef CONFIG_BALLOON_MIGRATION
> [I(BALLOON_MIGRATE)] = "balloon_migrate",
> #endif /* CONFIG_BALLOON_MIGRATION */
> -#endif /* CONFIG_MEMORY_BALLOON */
> +#endif /* CONFIG_BALLOON */
> #ifdef CONFIG_DEBUG_TLBFLUSH
> [I(NR_TLB_REMOTE_FLUSH)] = "nr_tlb_remote_flush",
> [I(NR_TLB_REMOTE_FLUSH_RECEIVED)] = "nr_tlb_remote_flush_received",
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 05/23] mm/balloon_compaction: centralize adjust_managed_page_count() handling
2026-01-15 9:19 ` [PATCH v2 05/23] mm/balloon_compaction: centralize adjust_managed_page_count() handling David Hildenbrand (Red Hat)
@ 2026-01-15 14:06 ` Liam R. Howlett
0 siblings, 0 replies; 65+ messages in thread
From: Liam R. Howlett @ 2026-01-15 14:06 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Lorenzo Stoakes, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
* David Hildenbrand (Red Hat) <david@kernel.org> [260115 04:21]:
> Let's centralize it, by allowing for the driver to enable this handling
> through a new flag (bool for now) in the balloon device info.
>
> Note that we now adjust the counter when adding/removing a page into the
> balloon list: when removing a page to deflate it, it will now happen
> before the driver communicated with hypervisor, not afterwards.
>
> This shouldn't make a difference in practice.
>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
For what it's worth,
Acked-by: Liam R. Howlett <Liam.Howlett@oracle.com>
> ---
> arch/powerpc/platforms/pseries/cmm.c | 13 +------------
> drivers/virtio/virtio_balloon.c | 19 ++-----------------
> include/linux/balloon_compaction.h | 2 ++
> mm/balloon_compaction.c | 17 +++++++++++++++++
> 4 files changed, 22 insertions(+), 29 deletions(-)
>
> diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
> index 15f873f733a41..7fd8b3d7e7637 100644
> --- a/arch/powerpc/platforms/pseries/cmm.c
> +++ b/arch/powerpc/platforms/pseries/cmm.c
> @@ -165,7 +165,6 @@ static long cmm_alloc_pages(long nr)
>
> balloon_page_enqueue(&b_dev_info, page);
> atomic_long_inc(&loaned_pages);
> - adjust_managed_page_count(page, -1);
> nr--;
> }
>
> @@ -190,7 +189,6 @@ static long cmm_free_pages(long nr)
> if (!page)
> break;
> plpar_page_set_active(page);
> - adjust_managed_page_count(page, 1);
> __free_page(page);
> atomic_long_dec(&loaned_pages);
> nr--;
> @@ -515,16 +513,6 @@ static int cmm_migratepage(struct balloon_dev_info *b_dev_info,
> return -EBUSY;
> }
>
> - /*
> - * When we migrate a page to a different zone, we have to fixup the
> - * count of both involved zones as we adjusted the managed page count
> - * when inflating.
> - */
> - if (page_zone(page) != page_zone(newpage)) {
> - adjust_managed_page_count(page, 1);
> - adjust_managed_page_count(newpage, -1);
> - }
> -
> /*
> * activate/"deflate" the old page. We ignore any errors just like the
> * other callers.
> @@ -551,6 +539,7 @@ static int cmm_init(void)
> return -EOPNOTSUPP;
>
> balloon_devinfo_init(&b_dev_info);
> + b_dev_info.adjust_managed_page_count = true;
> if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
> b_dev_info.migratepage = cmm_migratepage;
>
> diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> index df2756c071dae..15c1cf5fd249c 100644
> --- a/drivers/virtio/virtio_balloon.c
> +++ b/drivers/virtio/virtio_balloon.c
> @@ -274,9 +274,6 @@ static unsigned int fill_balloon(struct virtio_balloon *vb, size_t num)
>
> set_page_pfns(vb, vb->pfns + vb->num_pfns, page);
> vb->num_pages += VIRTIO_BALLOON_PAGES_PER_PAGE;
> - if (!virtio_has_feature(vb->vdev,
> - VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
> - adjust_managed_page_count(page, -1);
> vb->num_pfns += VIRTIO_BALLOON_PAGES_PER_PAGE;
> }
>
> @@ -295,9 +292,6 @@ static void release_pages_balloon(struct virtio_balloon *vb,
> struct page *page, *next;
>
> list_for_each_entry_safe(page, next, pages, lru) {
> - if (!virtio_has_feature(vb->vdev,
> - VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
> - adjust_managed_page_count(page, 1);
> list_del(&page->lru);
> put_page(page); /* balloon reference */
> }
> @@ -839,17 +833,6 @@ static int virtballoon_migratepage(struct balloon_dev_info *vb_dev_info,
> if (!mutex_trylock(&vb->balloon_lock))
> return -EAGAIN;
>
> - /*
> - * When we migrate a page to a different zone and adjusted the
> - * managed page count when inflating, we have to fixup the count of
> - * both involved zones.
> - */
> - if (!virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM) &&
> - page_zone(page) != page_zone(newpage)) {
> - adjust_managed_page_count(page, 1);
> - adjust_managed_page_count(newpage, -1);
> - }
> -
> /* balloon's page migration 1st step -- inflate "newpage" */
> vb->num_pfns = VIRTIO_BALLOON_PAGES_PER_PAGE;
> set_page_pfns(vb, vb->pfns, newpage);
> @@ -958,6 +941,8 @@ static int virtballoon_probe(struct virtio_device *vdev)
> if (err)
> goto out_free_vb;
>
> + if (!virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
> + vb->vb_dev_info.adjust_managed_page_count = true;
> #ifdef CONFIG_BALLOON_COMPACTION
> vb->vb_dev_info.migratepage = virtballoon_migratepage;
> #endif
> diff --git a/include/linux/balloon_compaction.h b/include/linux/balloon_compaction.h
> index 7cfe48769239e..3109d3c43d306 100644
> --- a/include/linux/balloon_compaction.h
> +++ b/include/linux/balloon_compaction.h
> @@ -56,6 +56,7 @@ struct balloon_dev_info {
> struct list_head pages; /* Pages enqueued & handled to Host */
> int (*migratepage)(struct balloon_dev_info *, struct page *newpage,
> struct page *page, enum migrate_mode mode);
> + bool adjust_managed_page_count;
> };
>
> extern struct page *balloon_page_alloc(void);
> @@ -73,6 +74,7 @@ static inline void balloon_devinfo_init(struct balloon_dev_info *balloon)
> spin_lock_init(&balloon->pages_lock);
> INIT_LIST_HEAD(&balloon->pages);
> balloon->migratepage = NULL;
> + balloon->adjust_managed_page_count = false;
> }
>
> #ifdef CONFIG_BALLOON_COMPACTION
> diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c
> index 5444c61bb9e76..fd9ec47cf4670 100644
> --- a/mm/balloon_compaction.c
> +++ b/mm/balloon_compaction.c
> @@ -23,6 +23,8 @@ static void balloon_page_enqueue_one(struct balloon_dev_info *b_dev_info,
> BUG_ON(!trylock_page(page));
> balloon_page_insert(b_dev_info, page);
> unlock_page(page);
> + if (b_dev_info->adjust_managed_page_count)
> + adjust_managed_page_count(page, -1);
> __count_vm_event(BALLOON_INFLATE);
> inc_node_page_state(page, NR_BALLOON_PAGES);
> }
> @@ -95,6 +97,8 @@ size_t balloon_page_list_dequeue(struct balloon_dev_info *b_dev_info,
> continue;
>
> list_del(&page->lru);
> + if (b_dev_info->adjust_managed_page_count)
> + adjust_managed_page_count(page, 1);
> balloon_page_finalize(page);
> __count_vm_event(BALLOON_DEFLATE);
> list_add(&page->lru, pages);
> @@ -256,12 +260,25 @@ static int balloon_page_migrate(struct page *newpage, struct page *page,
>
> balloon_page_insert(b_dev_info, newpage);
> __count_vm_event(BALLOON_MIGRATE);
> +
> + if (b_dev_info->adjust_managed_page_count &&
> + page_zone(page) != page_zone(newpage)) {
> + /*
> + * When we migrate a page to a different zone we
> + * have to fixup the count of both involved zones.
> + */
> + adjust_managed_page_count(page, 1);
> + adjust_managed_page_count(newpage, -1);
> + }
> break;
> case -ENOENT:
> spin_lock_irqsave(&b_dev_info->pages_lock, flags);
>
> /* Old page was deflated but new page not inflated. */
> __count_vm_event(BALLOON_DEFLATE);
> +
> + if (b_dev_info->adjust_managed_page_count)
> + adjust_managed_page_count(page, 1);
> break;
> default:
> return rc;
> --
> 2.52.0
>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 22/23] mm: rename CONFIG_MEMORY_BALLOON -> CONFIG_BALLOON
2026-01-15 13:55 ` Lorenzo Stoakes
@ 2026-01-15 16:33 ` David Hildenbrand (Red Hat)
2026-01-15 16:50 ` Michael S. Tsirkin
` (2 more replies)
0 siblings, 3 replies; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 16:33 UTC (permalink / raw)
To: Lorenzo Stoakes
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On 1/15/26 14:55, Lorenzo Stoakes wrote:
> On Thu, Jan 15, 2026 at 10:20:12AM +0100, David Hildenbrand (Red Hat) wrote:
>> Let's make it consistent with the naming of the files but also with the
>> naming of CONFIG_BALLOON_MIGRATION.
>>
>> While at it, add a "/* CONFIG_BALLOON */".
>
> Probably not relevant but cheap for me to share :) so grepped for
> 'memory_balloon' and saw:
>
> include/uapi/linux/virtio_ids.h
> 44:#define VIRTIO_ID_MEMORY_BALLOON 13 /* virtio memory balloon */
>
> This maybe relevant (I guess this isn't actually used anywhere?) though
> interesting there is also VIRTIO_ID_BALLOON... hmm :)
Yeah, we want to leave the virtio stuff alone.
Now you'll learn something you probably wish you wouldn't know:
As you spotted, there is
#define VIRTIO_ID_BALLOON 5 /* virtio balloon */
And
#define VIRTIO_ID_MEMORY_BALLOON 13 /* virtio memory balloon */
The virtio-spec [1] defines ID 5 to be the "Traditional Memory Balloon Device".
And in there, we document that
"This is the traditional balloon device. The device number 13 is reserved for
a new memory balloon interface, with different semantics, which is expected
in a future version of the standard. "
That's in the spec already like, forever. Likely, at some point someone wanted to implement a
new version (for whatever reason) and defined ID 13. But that never happened.
So now we have these beautiful two device IDs.
I'll note that the spec also defines a "DEVICE ID of Virtio Cpu balloon device as 47". But
no changes really happened in the spec with that for the last two years (only the
id is reserved).
[1] https://docs.oasis-open.org/virtio/virtio/v1.4/virtio-v1.4.html#x1-4260001
--
Cheers
David
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 22/23] mm: rename CONFIG_MEMORY_BALLOON -> CONFIG_BALLOON
2026-01-15 16:33 ` David Hildenbrand (Red Hat)
@ 2026-01-15 16:50 ` Michael S. Tsirkin
2026-01-15 16:53 ` Michael S. Tsirkin
2026-01-15 16:57 ` Lorenzo Stoakes
2 siblings, 0 replies; 65+ messages in thread
From: Michael S. Tsirkin @ 2026-01-15 16:50 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: Lorenzo Stoakes, linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Jason Wang, Xuan Zhuo, Eugenio Pérez,
Zi Yan
On Thu, Jan 15, 2026 at 05:33:56PM +0100, David Hildenbrand (Red Hat) wrote:
> On 1/15/26 14:55, Lorenzo Stoakes wrote:
> > On Thu, Jan 15, 2026 at 10:20:12AM +0100, David Hildenbrand (Red Hat) wrote:
> > > Let's make it consistent with the naming of the files but also with the
> > > naming of CONFIG_BALLOON_MIGRATION.
> > >
> > > While at it, add a "/* CONFIG_BALLOON */".
> >
> > Probably not relevant but cheap for me to share :) so grepped for
> > 'memory_balloon' and saw:
> >
> > include/uapi/linux/virtio_ids.h
> > 44:#define VIRTIO_ID_MEMORY_BALLOON 13 /* virtio memory balloon */
> >
> > This maybe relevant (I guess this isn't actually used anywhere?) though
> > interesting there is also VIRTIO_ID_BALLOON... hmm :)
>
> Yeah, we want to leave the virtio stuff alone.
>
> Now you'll learn something you probably wish you wouldn't know:
>
> As you spotted, there is
>
> #define VIRTIO_ID_BALLOON 5 /* virtio balloon */
>
> And
>
> #define VIRTIO_ID_MEMORY_BALLOON 13 /* virtio memory balloon */
>
>
> The virtio-spec [1] defines ID 5 to be the "Traditional Memory Balloon Device".
>
> And in there, we document that
>
> "This is the traditional balloon device. The device number 13 is reserved for
> a new memory balloon interface, with different semantics, which is expected
> in a future version of the standard. "
>
> That's in the spec already like, forever. Likely, at some point someone wanted to implement a
> new version (for whatever reason) and defined ID 13. But that never happened.
yea Rusty wanted to do that. balloon has lots of weird bugs like it does
not really works with large guests. We really need to get around to
fixing this, and maybe it's cleaner to do that with a new ID
than trying and failing to use the old one, was the thinking.
> So now we have these beautiful two device IDs.
>
> I'll note that the spec also defines a "DEVICE ID of Virtio Cpu balloon device as 47". But
> no changes really happened in the spec with that for the last two years (only the
> id is reserved).
>
>
> [1] https://docs.oasis-open.org/virtio/virtio/v1.4/virtio-v1.4.html#x1-4260001
>
> --
> Cheers
>
> David
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 22/23] mm: rename CONFIG_MEMORY_BALLOON -> CONFIG_BALLOON
2026-01-15 16:33 ` David Hildenbrand (Red Hat)
2026-01-15 16:50 ` Michael S. Tsirkin
@ 2026-01-15 16:53 ` Michael S. Tsirkin
2026-01-15 16:56 ` David Hildenbrand (Red Hat)
2026-01-15 16:57 ` Lorenzo Stoakes
2 siblings, 1 reply; 65+ messages in thread
From: Michael S. Tsirkin @ 2026-01-15 16:53 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: Lorenzo Stoakes, linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Jason Wang, Xuan Zhuo, Eugenio Pérez,
Zi Yan
On Thu, Jan 15, 2026 at 05:33:56PM +0100, David Hildenbrand (Red Hat) wrote:
> I'll note that the spec also defines a "DEVICE ID of Virtio Cpu balloon device as 47". But
> no changes really happened in the spec with that for the last two years (only the
> id is reserved).
>
>
> [1] https://docs.oasis-open.org/virtio/virtio/v1.4/virtio-v1.4.html#x1-4260001
Maybe that's a good reason to keep calling it "memory balloon".
And hey, there's also the floating, pops easily kind and maybe someone
will use those with linux in some way :)
> --
> Cheers
>
> David
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 22/23] mm: rename CONFIG_MEMORY_BALLOON -> CONFIG_BALLOON
2026-01-15 16:53 ` Michael S. Tsirkin
@ 2026-01-15 16:56 ` David Hildenbrand (Red Hat)
0 siblings, 0 replies; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 16:56 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Lorenzo Stoakes, linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Jason Wang, Xuan Zhuo, Eugenio Pérez,
Zi Yan
On 1/15/26 17:53, Michael S. Tsirkin wrote:
> On Thu, Jan 15, 2026 at 05:33:56PM +0100, David Hildenbrand (Red Hat) wrote:
>> I'll note that the spec also defines a "DEVICE ID of Virtio Cpu balloon device as 47". But
>> no changes really happened in the spec with that for the last two years (only the
>> id is reserved).
>>
>>
>> [1] https://docs.oasis-open.org/virtio/virtio/v1.4/virtio-v1.4.html#x1-4260001
>
>
> Maybe that's a good reason to keep calling it "memory balloon".
>
> And hey, there's also the floating, pops easily kind and maybe someone
> will use those with linux in some way :)
There is only one true balloon ;) the others can specify it as
CPU_BALLOON. If that ever sees the light of day.
--
Cheers
David
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 22/23] mm: rename CONFIG_MEMORY_BALLOON -> CONFIG_BALLOON
2026-01-15 16:33 ` David Hildenbrand (Red Hat)
2026-01-15 16:50 ` Michael S. Tsirkin
2026-01-15 16:53 ` Michael S. Tsirkin
@ 2026-01-15 16:57 ` Lorenzo Stoakes
2 siblings, 0 replies; 65+ messages in thread
From: Lorenzo Stoakes @ 2026-01-15 16:57 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On Thu, Jan 15, 2026 at 05:33:56PM +0100, David Hildenbrand (Red Hat) wrote:
> On 1/15/26 14:55, Lorenzo Stoakes wrote:
> > On Thu, Jan 15, 2026 at 10:20:12AM +0100, David Hildenbrand (Red Hat) wrote:
> > > Let's make it consistent with the naming of the files but also with the
> > > naming of CONFIG_BALLOON_MIGRATION.
> > >
> > > While at it, add a "/* CONFIG_BALLOON */".
> >
> > Probably not relevant but cheap for me to share :) so grepped for
> > 'memory_balloon' and saw:
> >
> > include/uapi/linux/virtio_ids.h
> > 44:#define VIRTIO_ID_MEMORY_BALLOON 13 /* virtio memory balloon */
> >
> > This maybe relevant (I guess this isn't actually used anywhere?) though
> > interesting there is also VIRTIO_ID_BALLOON... hmm :)
>
> Yeah, we want to leave the virtio stuff alone.
>
> Now you'll learn something you probably wish you wouldn't know:
>
> As you spotted, there is
>
> #define VIRTIO_ID_BALLOON 5 /* virtio balloon */
>
> And
>
> #define VIRTIO_ID_MEMORY_BALLOON 13 /* virtio memory balloon */
>
>
> The virtio-spec [1] defines ID 5 to be the "Traditional Memory Balloon Device".
>
> And in there, we document that
>
> "This is the traditional balloon device. The device number 13 is reserved for
> a new memory balloon interface, with different semantics, which is expected
> in a future version of the standard. "
>
> That's in the spec already like, forever. Likely, at some point someone wanted to implement a
> new version (for whatever reason) and defined ID 13. But that never happened.
>
> So now we have these beautiful two device IDs.
>
> I'll note that the spec also defines a "DEVICE ID of Virtio Cpu balloon device as 47". But
> no changes really happened in the spec with that for the last two years (only the
> id is reserved).
>
>
> [1] https://docs.oasis-open.org/virtio/virtio/v1.4/virtio-v1.4.html#x1-4260001
>
Lord haha well that explains that ;)
> --
> Cheers
>
> David
Cheers, Lorenzo
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 00/23] mm: balloon infrastructure cleanups
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
` (23 preceding siblings ...)
2026-01-15 9:32 ` [PATCH v2 00/23] mm: balloon infrastructure cleanups Michael S. Tsirkin
@ 2026-01-15 18:49 ` Andrew Morton
2026-01-15 19:47 ` David Hildenbrand (Red Hat)
24 siblings, 1 reply; 65+ messages in thread
From: Andrew Morton @ 2026-01-15 18:49 UTC (permalink / raw)
To: David Hildenbrand (Red Hat)
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
On Thu, 15 Jan 2026 10:19:50 +0100 "David Hildenbrand (Red Hat)" <david@kernel.org> wrote:
> I started with wanting to remove the dependency of the balloon
> infrastructure on the page lock, but ended up performing various other
> cleanups, some of which I had on my todo list for years.
>
> This series heavily cleans up and simplifies our balloon infrastructure,
> including our balloon page migration functionality.
Thanks, I'll add this. Again, I'll suppress the ensuing 528 emails.
Sigh, I do worry that the ongoing email deluge is training people to
ignore addition of things to mm.git. Maybe more emails like this one
is the way to address this.
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 00/23] mm: balloon infrastructure cleanups
2026-01-15 18:49 ` Andrew Morton
@ 2026-01-15 19:47 ` David Hildenbrand (Red Hat)
0 siblings, 0 replies; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-15 19:47 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Oscar Salvador, Lorenzo Stoakes, Liam R. Howlett,
Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko,
Jonathan Corbet, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy, Arnd Bergmann,
Greg Kroah-Hartman, Jerrin Shaji George, Michael S. Tsirkin,
Jason Wang, Xuan Zhuo, Eugenio Pérez, Zi Yan
On 1/15/26 19:49, Andrew Morton wrote:
> On Thu, 15 Jan 2026 10:19:50 +0100 "David Hildenbrand (Red Hat)" <david@kernel.org> wrote:
>
>> I started with wanting to remove the dependency of the balloon
>> infrastructure on the page lock, but ended up performing various other
>> cleanups, some of which I had on my todo list for years.
>>
>> This series heavily cleans up and simplifies our balloon infrastructure,
>> including our balloon page migration functionality.
>
> Thanks, I'll add this. Again, I'll suppress the ensuing 528 emails.
>
> Sigh, I do worry that the ongoing email deluge is training people to
> ignore addition of things to mm.git. Maybe more emails like this one
> is the way to address this.
It would be sufficient to only send a single mail for the whole
patchset, maybe?
--
Cheers
David
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 04/23] mm/balloon_compaction: centralize basic page migration handling
2026-01-15 9:19 ` [PATCH v2 04/23] mm/balloon_compaction: centralize basic page migration handling David Hildenbrand (Red Hat)
2026-01-15 12:18 ` Lorenzo Stoakes
@ 2026-01-19 22:22 ` David Hildenbrand (Red Hat)
2026-01-19 22:25 ` David Hildenbrand (Red Hat)
1 sibling, 1 reply; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-19 22:22 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, Andrew Morton, Oscar Salvador,
Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On 1/15/26 10:19, David Hildenbrand (Red Hat) wrote:
> Let's update the balloon page references, the balloon page list, the
> BALLOON_MIGRATE counter and the isolated-pages counter in
> balloon_page_migrate(), after letting the balloon->migratepage()
> callback deal with the actual inflation+deflation.
>
> Note that we now perform the balloon list modifications outside of any
> implementation-specific locks: which is fine, there is nothing special
> about these page actions that the lock would be protecting.
>
> The old page is already no longer in the list (isolated) and the new page
> is not yet in the list.
>
> Let's use -ENOENT to communicate the special "inflation of new page
> failed after already deflating the old page" to balloon_page_migrate() so
> it can handle it accordingly.
>
> While at it, rename balloon->b_dev_info to make it match the other
> functions. Also, drop the comment above balloon_page_migrate(), which
> seems unnecessary.
>
> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
> ---
Andrew, the following on top:
From 4c8b4f0aba5859a4ec71c7449a98b10e0547237f Mon Sep 17 00:00:00 2001
From: "David Hildenbrand (Red Hat)" <david@kernel.org>
Date: Mon, 19 Jan 2026 23:20:41 +0100
Subject: [PATCH] fixup: mm/balloon_compaction: centralize basic page migration
handling
Remove newline, talk about "page" instead of "old page" and avoid the
switch.
Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
---
mm/balloon_compaction.c | 22 +++++++---------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c
index 5444c61bb9e76..b859411811d0b 100644
--- a/mm/balloon_compaction.c
+++ b/mm/balloon_compaction.c
@@ -247,29 +247,21 @@ static int balloon_page_migrate(struct page *newpage, struct page *page,
return -EAGAIN;
rc = b_dev_info->migratepage(b_dev_info, newpage, page, mode);
- switch (rc) {
- case 0:
- spin_lock_irqsave(&b_dev_info->pages_lock, flags);
+ if (rc < 0 && rc != -ENOENT)
+ return rc;
+ spin_lock_irqsave(&b_dev_info->pages_lock, flags);
+ if (!rc) {
/* Insert the new page into the balloon list. */
get_page(newpage);
-
balloon_page_insert(b_dev_info, newpage);
- __count_vm_event(BALLOON_MIGRATE);
- break;
- case -ENOENT:
- spin_lock_irqsave(&b_dev_info->pages_lock, flags);
-
- /* Old page was deflated but new page not inflated. */
- __count_vm_event(BALLOON_DEFLATE);
- break;
- default:
- return rc;
}
-
b_dev_info->isolated_pages--;
spin_unlock_irqrestore(&b_dev_info->pages_lock, flags);
+ /* If -ENOENT, page was deflated but new page not inflated. */
+ __count_vm_event(rc ? BALLOON_DEFLATE : BALLOON_MIGRATE);
+
/* Free the now-deflated page we isolated in balloon_page_isolate(). */
balloon_page_finalize(page);
put_page(page);
--
2.52.0
--
Cheers
David
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 04/23] mm/balloon_compaction: centralize basic page migration handling
2026-01-19 22:22 ` David Hildenbrand (Red Hat)
@ 2026-01-19 22:25 ` David Hildenbrand (Red Hat)
0 siblings, 0 replies; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-19 22:25 UTC (permalink / raw)
To: linux-kernel
Cc: linux-mm, linuxppc-dev, Broadcom internal kernel review list,
linux-doc, virtualization, Andrew Morton, Oscar Salvador,
Lorenzo Stoakes, Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
On 1/19/26 23:22, David Hildenbrand (Red Hat) wrote:
> On 1/15/26 10:19, David Hildenbrand (Red Hat) wrote:
>> Let's update the balloon page references, the balloon page list, the
>> BALLOON_MIGRATE counter and the isolated-pages counter in
>> balloon_page_migrate(), after letting the balloon->migratepage()
>> callback deal with the actual inflation+deflation.
>>
>> Note that we now perform the balloon list modifications outside of any
>> implementation-specific locks: which is fine, there is nothing special
>> about these page actions that the lock would be protecting.
>>
>> The old page is already no longer in the list (isolated) and the new page
>> is not yet in the list.
>>
>> Let's use -ENOENT to communicate the special "inflation of new page
>> failed after already deflating the old page" to balloon_page_migrate() so
>> it can handle it accordingly.
>>
>> While at it, rename balloon->b_dev_info to make it match the other
>> functions. Also, drop the comment above balloon_page_migrate(), which
>> seems unnecessary.
>>
>> Signed-off-by: David Hildenbrand (Red Hat) <david@kernel.org>
>> ---
>
> Andrew, the following on top:
Ah no, I'll rather resend the whole thing, as it creates some conflicts
in the other patches.
--
Cheers
David
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [PATCH v2 03/23] powerpc/pseries/cmm: remove cmm_balloon_compaction_init()
2026-01-15 11:46 ` Lorenzo Stoakes
@ 2026-01-19 22:44 ` David Hildenbrand (Red Hat)
0 siblings, 0 replies; 65+ messages in thread
From: David Hildenbrand (Red Hat) @ 2026-01-19 22:44 UTC (permalink / raw)
To: Lorenzo Stoakes
Cc: linux-kernel, linux-mm, linuxppc-dev,
Broadcom internal kernel review list, linux-doc, virtualization,
Andrew Morton, Oscar Salvador, Liam R. Howlett, Vlastimil Babka,
Mike Rapoport, Suren Baghdasaryan, Michal Hocko, Jonathan Corbet,
Madhavan Srinivasan, Michael Ellerman, Nicholas Piggin,
Christophe Leroy, Arnd Bergmann, Greg Kroah-Hartman,
Jerrin Shaji George, Michael S. Tsirkin, Jason Wang, Xuan Zhuo,
Eugenio Pérez, Zi Yan
>> @@ -573,11 +567,12 @@ static int cmm_init(void)
>> return -EOPNOTSUPP;
>>
>> balloon_devinfo_init(&b_dev_info);
>> - cmm_balloon_compaction_init();
>> + if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
>> + b_dev_info.migratepage = cmm_migratepage;
>>
>> rc = register_oom_notifier(&cmm_oom_nb);
>> if (rc < 0)
>> - goto out_balloon_compaction;
>> + return rc;
>>
>> if ((rc = register_reboot_notifier(&cmm_reboot_nb)))
>> goto out_oom_notifier;
>> @@ -606,7 +601,6 @@ static int cmm_init(void)
>> unregister_reboot_notifier(&cmm_reboot_nb);
>> out_oom_notifier:
>> unregister_oom_notifier(&cmm_oom_nb);
>> -out_balloon_compaction:
>
> So silly, I assume before there was more that happened here?
Right, I commented that above in the patch description.
Thanks!
--
Cheers
David
^ permalink raw reply [flat|nested] 65+ messages in thread
end of thread, other threads:[~2026-01-19 22:45 UTC | newest]
Thread overview: 65+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-15 9:19 [PATCH v2 00/23] mm: balloon infrastructure cleanups David Hildenbrand (Red Hat)
2026-01-15 9:19 ` [PATCH v2 01/23] vmw_balloon: adjust BALLOON_DEFLATE when deflating while migrating David Hildenbrand (Red Hat)
2026-01-15 9:56 ` Lorenzo Stoakes
2026-01-15 9:19 ` [PATCH v2 02/23] vmw_balloon: remove vmballoon_compaction_init() David Hildenbrand (Red Hat)
2026-01-15 11:20 ` Lorenzo Stoakes
2026-01-15 9:19 ` [PATCH v2 03/23] powerpc/pseries/cmm: remove cmm_balloon_compaction_init() David Hildenbrand (Red Hat)
2026-01-15 11:46 ` Lorenzo Stoakes
2026-01-19 22:44 ` David Hildenbrand (Red Hat)
2026-01-15 9:19 ` [PATCH v2 04/23] mm/balloon_compaction: centralize basic page migration handling David Hildenbrand (Red Hat)
2026-01-15 12:18 ` Lorenzo Stoakes
2026-01-15 12:57 ` David Hildenbrand (Red Hat)
2026-01-19 22:22 ` David Hildenbrand (Red Hat)
2026-01-19 22:25 ` David Hildenbrand (Red Hat)
2026-01-15 9:19 ` [PATCH v2 05/23] mm/balloon_compaction: centralize adjust_managed_page_count() handling David Hildenbrand (Red Hat)
2026-01-15 14:06 ` Liam R. Howlett
2026-01-15 9:19 ` [PATCH v2 06/23] vmw_balloon: stop using the balloon_dev_info lock David Hildenbrand (Red Hat)
2026-01-15 12:21 ` Lorenzo Stoakes
2026-01-15 12:26 ` David Hildenbrand (Red Hat)
2026-01-15 9:19 ` [PATCH v2 07/23] mm/balloon_compaction: use a device-independent balloon (list) lock David Hildenbrand (Red Hat)
2026-01-15 9:19 ` [PATCH v2 08/23] mm/balloon_compaction: remove dependency on page lock David Hildenbrand (Red Hat)
2026-01-15 9:19 ` [PATCH v2 09/23] mm/balloon_compaction: make balloon_mops static David Hildenbrand (Red Hat)
2026-01-15 12:22 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 10/23] mm/balloon_compaction: drop fs.h include from balloon_compaction.h David Hildenbrand (Red Hat)
2026-01-15 12:25 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 11/23] drivers/virtio/virtio_balloon: stop using balloon_page_push/pop() David Hildenbrand (Red Hat)
2026-01-15 12:28 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 12/23] mm/balloon_compaction: remove balloon_page_push/pop() David Hildenbrand (Red Hat)
2026-01-15 12:29 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 13/23] mm/balloon_compaction: fold balloon_mapping_gfp_mask() into balloon_page_alloc() David Hildenbrand (Red Hat)
2026-01-15 12:30 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 14/23] mm/balloon_compaction: move internal helpers to balloon_compaction.c David Hildenbrand (Red Hat)
2026-01-15 12:32 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 15/23] mm/balloon_compaction: assert that the balloon_pages_lock is held David Hildenbrand (Red Hat)
2026-01-15 12:32 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 16/23] mm/balloon_compaction: mark remaining functions for having proper kerneldoc David Hildenbrand (Red Hat)
2026-01-15 12:33 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 17/23] mm/balloon_compaction: remove "extern" from functions David Hildenbrand (Red Hat)
2026-01-15 12:34 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 18/23] mm/vmscan: drop inclusion of balloon_compaction.h David Hildenbrand (Red Hat)
2026-01-15 13:42 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 19/23] mm: rename balloon_compaction.(c|h) to balloon.(c|h) David Hildenbrand (Red Hat)
2026-01-15 13:45 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 20/23] mm/kconfig: make BALLOON_COMPACTION depend on MIGRATION David Hildenbrand (Red Hat)
2026-01-15 13:47 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 21/23] mm: rename CONFIG_BALLOON_COMPACTION to CONFIG_BALLOON_MIGRATION David Hildenbrand (Red Hat)
2026-01-15 13:52 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 22/23] mm: rename CONFIG_MEMORY_BALLOON -> CONFIG_BALLOON David Hildenbrand (Red Hat)
2026-01-15 13:55 ` Lorenzo Stoakes
2026-01-15 16:33 ` David Hildenbrand (Red Hat)
2026-01-15 16:50 ` Michael S. Tsirkin
2026-01-15 16:53 ` Michael S. Tsirkin
2026-01-15 16:56 ` David Hildenbrand (Red Hat)
2026-01-15 16:57 ` Lorenzo Stoakes
2026-01-15 9:20 ` [PATCH v2 23/23] MAINTAINERS: move memory balloon infrastructure to "MEMORY MANAGEMENT - BALLOON" David Hildenbrand (Red Hat)
2026-01-15 9:32 ` Michael S. Tsirkin
2026-01-15 11:21 ` David Hildenbrand (Red Hat)
2026-01-15 9:38 ` Lance Yang
2026-01-15 11:22 ` David Hildenbrand (Red Hat)
2026-01-15 9:39 ` Lorenzo Stoakes
2026-01-15 11:25 ` David Hildenbrand (Red Hat)
2026-01-15 12:01 ` Vlastimil Babka
2026-01-15 9:32 ` [PATCH v2 00/23] mm: balloon infrastructure cleanups Michael S. Tsirkin
2026-01-15 11:26 ` David Hildenbrand (Red Hat)
2026-01-15 18:49 ` Andrew Morton
2026-01-15 19:47 ` David Hildenbrand (Red Hat)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox