Commit aa5dc07f authored by Matthew Wilcox's avatar Matthew Wilcox

mm: Convert huge_memory to XArray

Quite a straightforward conversion.
Signed-off-by: default avatarMatthew Wilcox <willy@infradead.org>
parent 89eb946a
...@@ -2443,13 +2443,13 @@ static void __split_huge_page(struct page *page, struct list_head *list, ...@@ -2443,13 +2443,13 @@ static void __split_huge_page(struct page *page, struct list_head *list,
ClearPageCompound(head); ClearPageCompound(head);
/* See comment in __split_huge_page_tail() */ /* See comment in __split_huge_page_tail() */
if (PageAnon(head)) { if (PageAnon(head)) {
/* Additional pin to radix tree of swap cache */ /* Additional pin to swap cache */
if (PageSwapCache(head)) if (PageSwapCache(head))
page_ref_add(head, 2); page_ref_add(head, 2);
else else
page_ref_inc(head); page_ref_inc(head);
} else { } else {
/* Additional pin to radix tree */ /* Additional pin to page cache */
page_ref_add(head, 2); page_ref_add(head, 2);
xa_unlock(&head->mapping->i_pages); xa_unlock(&head->mapping->i_pages);
} }
...@@ -2561,7 +2561,7 @@ bool can_split_huge_page(struct page *page, int *pextra_pins) ...@@ -2561,7 +2561,7 @@ bool can_split_huge_page(struct page *page, int *pextra_pins)
{ {
int extra_pins; int extra_pins;
/* Additional pins from radix tree */ /* Additional pins from page cache */
if (PageAnon(page)) if (PageAnon(page))
extra_pins = PageSwapCache(page) ? HPAGE_PMD_NR : 0; extra_pins = PageSwapCache(page) ? HPAGE_PMD_NR : 0;
else else
...@@ -2657,17 +2657,14 @@ int split_huge_page_to_list(struct page *page, struct list_head *list) ...@@ -2657,17 +2657,14 @@ int split_huge_page_to_list(struct page *page, struct list_head *list)
spin_lock_irqsave(zone_lru_lock(page_zone(head)), flags); spin_lock_irqsave(zone_lru_lock(page_zone(head)), flags);
if (mapping) { if (mapping) {
void **pslot; XA_STATE(xas, &mapping->i_pages, page_index(head));
xa_lock(&mapping->i_pages);
pslot = radix_tree_lookup_slot(&mapping->i_pages,
page_index(head));
/* /*
* Check if the head page is present in radix tree. * Check if the head page is present in page cache.
* We assume all tail are present too, if head is there. * We assume all tail are present too, if head is there.
*/ */
if (radix_tree_deref_slot_protected(pslot, xa_lock(&mapping->i_pages);
&mapping->i_pages.xa_lock) != head) if (xas_load(&xas) != head)
goto fail; goto fail;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment