[PATCH v1 01/29] mm/balloon_compaction: we cannot have isolated pages in the balloon list

David Hildenbrand posted 29 patches 3 months, 1 week ago
There is a newer version of this series
[PATCH v1 01/29] mm/balloon_compaction: we cannot have isolated pages in the balloon list
Posted by David Hildenbrand 3 months, 1 week ago
The core will set PG_isolated only after mops->isolate_page() was
called. In case of the balloon, that is where we will remove it from
the balloon list. So we cannot have isolated pages in the balloon list.

Let's drop this unnecessary check.

Acked-by: Zi Yan <ziy@nvidia.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 mm/balloon_compaction.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c
index d3e00731e2628..fcb60233aa35d 100644
--- a/mm/balloon_compaction.c
+++ b/mm/balloon_compaction.c
@@ -94,12 +94,6 @@ size_t balloon_page_list_dequeue(struct balloon_dev_info *b_dev_info,
 		if (!trylock_page(page))
 			continue;
 
-		if (IS_ENABLED(CONFIG_BALLOON_COMPACTION) &&
-		    PageIsolated(page)) {
-			/* raced with isolation */
-			unlock_page(page);
-			continue;
-		}
 		balloon_page_delete(page);
 		__count_vm_event(BALLOON_DEFLATE);
 		list_add(&page->lru, pages);
-- 
2.49.0
Re: [PATCH v1 01/29] mm/balloon_compaction: we cannot have isolated pages in the balloon list
Posted by Lorenzo Stoakes 3 months, 1 week ago
On Mon, Jun 30, 2025 at 02:59:42PM +0200, David Hildenbrand wrote:
> The core will set PG_isolated only after mops->isolate_page() was
> called. In case of the balloon, that is where we will remove it from
> the balloon list. So we cannot have isolated pages in the balloon list.

Indeed, I see isolate_movable_ops_page() is the only place the beautiful +
consistent macro SetPageMovableOpsIsolated() is invoked, and
balloon_page_isolate() invokes list_del(&page->lru).

The only case it doesn't do that is one where it returns false so the flag
wouldn't be set.

>
> Let's drop this unnecessary check.
>
> Acked-by: Zi Yan <ziy@nvidia.com>
> Signed-off-by: David Hildenbrand <david@redhat.com>

So,

Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>

> ---
>  mm/balloon_compaction.c | 6 ------
>  1 file changed, 6 deletions(-)
>
> diff --git a/mm/balloon_compaction.c b/mm/balloon_compaction.c
> index d3e00731e2628..fcb60233aa35d 100644
> --- a/mm/balloon_compaction.c
> +++ b/mm/balloon_compaction.c
> @@ -94,12 +94,6 @@ size_t balloon_page_list_dequeue(struct balloon_dev_info *b_dev_info,
>  		if (!trylock_page(page))
>  			continue;
>
> -		if (IS_ENABLED(CONFIG_BALLOON_COMPACTION) &&
> -		    PageIsolated(page)) {
> -			/* raced with isolation */
> -			unlock_page(page);
> -			continue;
> -		}
>  		balloon_page_delete(page);
>  		__count_vm_event(BALLOON_DEFLATE);
>  		list_add(&page->lru, pages);
> --
> 2.49.0
>