mm: add split_folio()

This wrapper removes a need to use split_huge_page(&folio->page).  Convert
two callers.

Link: https://lkml.kernel.org/r/20220902194653.1739778-5-willy@infradead.org
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
Matthew Wilcox (Oracle) 2022-09-02 20:46:00 +01:00 committed by Andrew Morton
parent c3a15bff46
commit d788f5b374
3 changed files with 7 additions and 2 deletions

View File

@ -444,6 +444,11 @@ static inline int split_folio_to_list(struct folio *folio,
return split_huge_page_to_list(&folio->page, list);
}
static inline int split_folio(struct folio *folio)
{
return split_folio_to_list(folio, NULL);
}
/*
* archs that select ARCH_WANTS_THP_SWAP but don't support THP_SWP due to
* limitations in the implementation like arm64 MTE can override this to

View File

@ -629,7 +629,7 @@ next:
goto move_back;
}
ret = split_huge_page(&folio->page);
ret = split_folio(folio);
folio_unlock(folio);
folio_put(folio);

View File

@ -240,7 +240,7 @@ bool truncate_inode_partial_folio(struct folio *folio, loff_t start, loff_t end)
folio_invalidate(folio, offset, length);
if (!folio_test_large(folio))
return true;
if (split_huge_page(&folio->page) == 0)
if (split_folio(folio) == 0)
return true;
if (folio_test_dirty(folio))
return false;