Re: [PATCH v2 13/23] mm/balloon_compaction: fold balloon_mapping_gfp_mask() into balloon_page_alloc()

Lorenzo Stoakes
2026-01-15T12:31:07Z

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
>