diff options
author | Vishal Moola (Oracle) <vishal.moola@gmail.com> | 2023-01-31 00:43:50 +0300 |
---|---|---|
committer | Andrew Morton <akpm@linux-foundation.org> | 2023-02-14 02:54:31 +0300 |
commit | da707a6d184a8a6ef0b756c3ba49888fec223793 (patch) | |
tree | d196661949ae0c9ee66743a65ed1aeba030c0a0e /include/linux/migrate.h | |
parent | 3c1ea2c729ef8ef07bcb80d01ab2ead45b3406dd (diff) | |
download | linux-da707a6d184a8a6ef0b756c3ba49888fec223793.tar.xz |
mm/migrate: add folio_movable_ops()
folio_movable_ops() does the same as page_movable_ops() except uses folios
instead of pages. This function will help make folio conversions in
migrate.c more readable.
Link: https://lkml.kernel.org/r/20230130214352.40538-3-vishal.moola@gmail.com
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'include/linux/migrate.h')
-rw-r--r-- | include/linux/migrate.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/migrate.h b/include/linux/migrate.h index 3ef77f52a4f0..bdff950a8bb4 100644 --- a/include/linux/migrate.h +++ b/include/linux/migrate.h @@ -123,6 +123,15 @@ static inline bool folio_test_movable(struct folio *folio) } static inline +const struct movable_operations *folio_movable_ops(struct folio *folio) +{ + VM_BUG_ON(!__folio_test_movable(folio)); + + return (const struct movable_operations *) + ((unsigned long)folio->mapping - PAGE_MAPPING_MOVABLE); +} + +static inline const struct movable_operations *page_movable_ops(struct page *page) { VM_BUG_ON(!__PageMovable(page)); |