Skip to content

Commit 5d94995

Browse files
VMoolaakpm00
authored andcommitted
mm: remove is_longterm_pinnable_page() and reimplement folio_is_longterm_pinnable()
folio_is_longterm_pinnable() already exists as a wrapper function. Now that the whole implementation of is_longterm_pinnable_page() can be implemented using folios, folio_is_longterm_pinnable() can be made its own standalone function - and we can remove is_longterm_pinnable_page(). Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Vishal Moola (Oracle) <[email protected]> Reviewed-by: Matthew Wilcox (Oracle) <[email protected]> Reviewed-by: Lorenzo Stoakes <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 503670e commit 5d94995

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

include/linux/mm.h

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1902,39 +1902,35 @@ static inline bool page_needs_cow_for_dma(struct vm_area_struct *vma,
19021902
return page_maybe_dma_pinned(page);
19031903
}
19041904

1905-
/* MIGRATE_CMA and ZONE_MOVABLE do not allow pin pages */
1905+
/* MIGRATE_CMA and ZONE_MOVABLE do not allow pin folios */
19061906
#ifdef CONFIG_MIGRATION
1907-
static inline bool is_longterm_pinnable_page(struct page *page)
1907+
static inline bool folio_is_longterm_pinnable(struct folio *folio)
19081908
{
19091909
#ifdef CONFIG_CMA
1910-
int mt = get_pageblock_migratetype(page);
1910+
int mt = folio_migratetype(folio);
19111911

19121912
if (mt == MIGRATE_CMA || mt == MIGRATE_ISOLATE)
19131913
return false;
19141914
#endif
19151915
/* The zero page may always be pinned */
1916-
if (is_zero_pfn(page_to_pfn(page)))
1916+
if (is_zero_pfn(folio_pfn(folio)))
19171917
return true;
19181918

19191919
/* Coherent device memory must always allow eviction. */
1920-
if (is_device_coherent_page(page))
1920+
if (folio_is_device_coherent(folio))
19211921
return false;
19221922

1923-
/* Otherwise, non-movable zone pages can be pinned. */
1924-
return !is_zone_movable_page(page);
1923+
/* Otherwise, non-movable zone folios can be pinned. */
1924+
return !folio_is_zone_movable(folio);
1925+
19251926
}
19261927
#else
1927-
static inline bool is_longterm_pinnable_page(struct page *page)
1928+
static inline bool folio_is_longterm_pinnable(struct folio *folio)
19281929
{
19291930
return true;
19301931
}
19311932
#endif
19321933

1933-
static inline bool folio_is_longterm_pinnable(struct folio *folio)
1934-
{
1935-
return is_longterm_pinnable_page(&folio->page);
1936-
}
1937-
19381934
static inline void set_page_zone(struct page *page, enum zone_type zone)
19391935
{
19401936
page->flags &= ~(ZONES_MASK << ZONES_PGSHIFT);

0 commit comments

Comments
 (0)