Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/balloon_compaction: stop using __ClearPageMovable()

We can just look at the balloon device (stored in page->private), to see
if the page is still part of the balloon.

As isolated balloon pages cannot get released (they are taken off the
balloon list while isolated), we don't have to worry about this case in
the putback and migration callback. Add a WARN_ON_ONCE for now.

Link: https://lkml.kernel.org/r/20250704102524.326966-14-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Brendan Jackman <jackmanb@google.com>
Cc: Byungchul Park <byungchul@sk.com>
Cc: Chengming Zhou <chengming.zhou@linux.dev>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Eugenio Pé rez <eperezma@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Gregory Price <gourry@gourry.net>
Cc: Harry Yoo <harry.yoo@oracle.com>
Cc: "Huang, Ying" <ying.huang@linux.alibaba.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Jerrin Shaji George <jerrin.shaji-george@broadcom.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Joshua Hahn <joshua.hahnjy@gmail.com>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Mathew Brost <matthew.brost@intel.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Peter Xu <peterx@redhat.com>
Cc: Qi Zheng <zhengqi.arch@bytedance.com>
Cc: Rakie Kim <rakie.kim@sk.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc: xu xin <xu.xin16@zte.com.cn>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

David Hildenbrand and committed by
Andrew Morton
3544c4fa a1092627

+12 -3
+1 -3
include/linux/balloon_compaction.h
··· 136 136 */ 137 137 static inline void balloon_page_finalize(struct page *page) 138 138 { 139 - if (IS_ENABLED(CONFIG_BALLOON_COMPACTION)) { 140 - __ClearPageMovable(page); 139 + if (IS_ENABLED(CONFIG_BALLOON_COMPACTION)) 141 140 set_page_private(page, 0); 142 - } 143 141 /* PageOffline is sticky until the page is freed to the buddy. */ 144 142 } 145 143
+11
mm/balloon_compaction.c
··· 206 206 struct balloon_dev_info *b_dev_info = balloon_page_device(page); 207 207 unsigned long flags; 208 208 209 + if (!b_dev_info) 210 + return false; 211 + 209 212 spin_lock_irqsave(&b_dev_info->pages_lock, flags); 210 213 list_del(&page->lru); 211 214 b_dev_info->isolated_pages++; ··· 221 218 { 222 219 struct balloon_dev_info *b_dev_info = balloon_page_device(page); 223 220 unsigned long flags; 221 + 222 + /* Isolated balloon pages cannot get deflated. */ 223 + if (WARN_ON_ONCE(!b_dev_info)) 224 + return; 224 225 225 226 spin_lock_irqsave(&b_dev_info->pages_lock, flags); 226 227 list_add(&page->lru, &b_dev_info->pages); ··· 240 233 241 234 VM_BUG_ON_PAGE(!PageLocked(page), page); 242 235 VM_BUG_ON_PAGE(!PageLocked(newpage), newpage); 236 + 237 + /* Isolated balloon pages cannot get deflated. */ 238 + if (WARN_ON_ONCE(!balloon)) 239 + return -EAGAIN; 243 240 244 241 return balloon->migratepage(balloon, newpage, page, mode); 245 242 }