mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 03:44:45 +01:00
mm/migrate: rename putback_movable_folio() to putback_movable_ops_page()
... and factor the complete handling of movable_ops pages out. Convert it similar to isolate_movable_ops_page(). While at it, convert the VM_BUG_ON_FOLIO() into a VM_WARN_ON_PAGE(). Link: https://lkml.kernel.org/r/20250704102524.326966-9-david@redhat.com Signed-off-by: David Hildenbrand <david@redhat.com> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Reviewed-by: Harry Yoo <harry.yoo@oracle.com> Reviewed-by: Zi Yan <ziy@nvidia.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: "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> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
6ef0c1976b
commit
d808f1f672
1 changed files with 23 additions and 12 deletions
35
mm/migrate.c
35
mm/migrate.c
|
|
@ -133,12 +133,30 @@ out:
|
|||
return false;
|
||||
}
|
||||
|
||||
static void putback_movable_folio(struct folio *folio)
|
||||
/**
|
||||
* putback_movable_ops_page - putback an isolated movable_ops page
|
||||
* @page: The isolated page.
|
||||
*
|
||||
* Putback an isolated movable_ops page.
|
||||
*
|
||||
* After the page was putback, it might get freed instantly.
|
||||
*/
|
||||
static void putback_movable_ops_page(struct page *page)
|
||||
{
|
||||
const struct movable_operations *mops = folio_movable_ops(folio);
|
||||
/*
|
||||
* TODO: these pages will not be folios in the future. All
|
||||
* folio dependencies will have to be removed.
|
||||
*/
|
||||
struct folio *folio = page_folio(page);
|
||||
|
||||
mops->putback_page(&folio->page);
|
||||
folio_clear_isolated(folio);
|
||||
VM_WARN_ON_ONCE_PAGE(!PageIsolated(page), page);
|
||||
folio_lock(folio);
|
||||
/* If the page was released by it's owner, there is nothing to do. */
|
||||
if (PageMovable(page))
|
||||
page_movable_ops(page)->putback_page(page);
|
||||
ClearPageIsolated(page);
|
||||
folio_unlock(folio);
|
||||
folio_put(folio);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -166,14 +184,7 @@ void putback_movable_pages(struct list_head *l)
|
|||
* have PAGE_MAPPING_MOVABLE.
|
||||
*/
|
||||
if (unlikely(__folio_test_movable(folio))) {
|
||||
VM_BUG_ON_FOLIO(!folio_test_isolated(folio), folio);
|
||||
folio_lock(folio);
|
||||
if (folio_test_movable(folio))
|
||||
putback_movable_folio(folio);
|
||||
else
|
||||
folio_clear_isolated(folio);
|
||||
folio_unlock(folio);
|
||||
folio_put(folio);
|
||||
putback_movable_ops_page(&folio->page);
|
||||
} else {
|
||||
node_stat_mod_folio(folio, NR_ISOLATED_ANON +
|
||||
folio_is_file_lru(folio), -folio_nr_pages(folio));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue