mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-17 18:36:00 +00:00
mm: convert split_huge_pages_pid() to use a folio
Replaces five calls to compound_head with one. Link: https://lkml.kernel.org/r/20230816151201.3655946-14-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: David Hildenbrand <david@redhat.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com> Cc: Yanteng Si <siyanteng@loongson.cn> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
b10ff04dc0
commit
a644b0abbf
@ -584,14 +584,11 @@ void folio_prep_large_rmappable(struct folio *folio)
|
||||
folio_set_large_rmappable(folio);
|
||||
}
|
||||
|
||||
static inline bool is_transparent_hugepage(struct page *page)
|
||||
static inline bool is_transparent_hugepage(struct folio *folio)
|
||||
{
|
||||
struct folio *folio;
|
||||
|
||||
if (!PageCompound(page))
|
||||
if (!folio_test_large(folio))
|
||||
return false;
|
||||
|
||||
folio = page_folio(page);
|
||||
return is_huge_zero_page(&folio->page) ||
|
||||
folio_test_large_rmappable(folio);
|
||||
}
|
||||
@ -3012,6 +3009,7 @@ static int split_huge_pages_pid(int pid, unsigned long vaddr_start,
|
||||
for (addr = vaddr_start; addr < vaddr_end; addr += PAGE_SIZE) {
|
||||
struct vm_area_struct *vma = vma_lookup(mm, addr);
|
||||
struct page *page;
|
||||
struct folio *folio;
|
||||
|
||||
if (!vma)
|
||||
break;
|
||||
@ -3028,22 +3026,23 @@ static int split_huge_pages_pid(int pid, unsigned long vaddr_start,
|
||||
if (IS_ERR_OR_NULL(page))
|
||||
continue;
|
||||
|
||||
if (!is_transparent_hugepage(page))
|
||||
folio = page_folio(page);
|
||||
if (!is_transparent_hugepage(folio))
|
||||
goto next;
|
||||
|
||||
total++;
|
||||
if (!can_split_folio(page_folio(page), NULL))
|
||||
if (!can_split_folio(folio, NULL))
|
||||
goto next;
|
||||
|
||||
if (!trylock_page(page))
|
||||
if (!folio_trylock(folio))
|
||||
goto next;
|
||||
|
||||
if (!split_huge_page(page))
|
||||
if (!split_folio(folio))
|
||||
split++;
|
||||
|
||||
unlock_page(page);
|
||||
folio_unlock(folio);
|
||||
next:
|
||||
put_page(page);
|
||||
folio_put(folio);
|
||||
cond_resched();
|
||||
}
|
||||
mmap_read_unlock(mm);
|
||||
|
Loading…
x
Reference in New Issue
Block a user