On Mon, Jun 30, 2025 at 03:00:10PM +0200, David Hildenbrand wrote: > Let's just special-case based on IS_ENABLED(CONFIG_BALLOON_COMPACTION > like we did for balloon_page_finalize(). > > Signed-off-by: David Hildenbrand <da...@redhat.com>
LGTM, so: Reviewed-by: Lorenzo Stoakes <lorenzo.stoa...@oracle.com> > --- > include/linux/balloon_compaction.h | 42 +++++++++++------------------- > 1 file changed, 15 insertions(+), 27 deletions(-) > > diff --git a/include/linux/balloon_compaction.h > b/include/linux/balloon_compaction.h > index 2fecfead91d26..7cfe48769239e 100644 > --- a/include/linux/balloon_compaction.h > +++ b/include/linux/balloon_compaction.h > @@ -77,6 +77,15 @@ 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. > + */ > +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 > @@ -91,41 +100,20 @@ static inline void balloon_page_insert(struct > balloon_dev_info *balloon, > struct page *page) > { > __SetPageOffline(page); > - SetPageMovableOps(page); > - set_page_private(page, (unsigned long)balloon); > - list_add(&page->lru, &balloon->pages); > -} > - > -/* > - * 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); > -} > - > -static inline gfp_t balloon_mapping_gfp_mask(void) > -{ > - return GFP_HIGHUSER_MOVABLE; > -} > - > -#else /* !CONFIG_BALLOON_COMPACTION */ > - > -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); > } > > static inline gfp_t balloon_mapping_gfp_mask(void) > { > + if (IS_ENABLED(CONFIG_BALLOON_COMPACTION)) > + return GFP_HIGHUSER_MOVABLE; > return GFP_HIGHUSER; > } > > -#endif /* CONFIG_BALLOON_COMPACTION */ > - > /* > * balloon_page_finalize - prepare a balloon page that was removed from the > * balloon list for release to the page allocator > -- > 2.49.0 >