Using lruvec lock to replace pgdat lru_lock.

Signed-off-by: Alex Shi <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: "Kirill A. Shutemov" <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: "Jérôme Glisse" <[email protected]>
Cc: Andrea Arcangeli <[email protected]>
Cc: "Aneesh Kumar K.V" <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Souptick Joarder <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
 mm/huge_memory.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 3a483deee807..9a96c0944b4d 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -2529,7 +2529,7 @@ static void __split_huge_page(struct page *page, struct 
list_head *list,
                xa_unlock(&head->mapping->i_pages);
        }
 
-       spin_unlock_irqrestore(&pgdat->lruvec.lru_lock, flags);
+       spin_unlock_irqrestore(&lruvec->lru_lock, flags);
 
        remap_page(head);
 
@@ -2671,6 +2671,7 @@ int split_huge_page_to_list(struct page *page, struct 
list_head *list)
        struct pglist_data *pgdata = NODE_DATA(page_to_nid(head));
        struct anon_vma *anon_vma = NULL;
        struct address_space *mapping = NULL;
+       struct lruvec *lruvec;
        int count, mapcount, extra_pins, ret;
        bool mlocked;
        unsigned long flags;
@@ -2739,8 +2740,10 @@ int split_huge_page_to_list(struct page *page, struct 
list_head *list)
        if (mlocked)
                lru_add_drain();
 
+       lruvec = mem_cgroup_page_lruvec(head, pgdata);
        /* prevent PageLRU to go away from under us, and freeze lru stats */
-       spin_lock_irqsave(&pgdata->lruvec.lru_lock, flags);
+       spin_lock_irqsave(&lruvec->lru_lock, flags);
+       sync_lruvec_pgdat(lruvec, pgdata);
 
        if (mapping) {
                XA_STATE(xas, &mapping->i_pages, page_index(head));
@@ -2785,7 +2788,7 @@ int split_huge_page_to_list(struct page *page, struct 
list_head *list)
                spin_unlock(&pgdata->split_queue_lock);
 fail:          if (mapping)
                        xa_unlock(&mapping->i_pages);
-               spin_unlock_irqrestore(&pgdata->lruvec.lru_lock, flags);
+               spin_unlock_irqrestore(&lruvec->lru_lock, flags);
                remap_page(head);
                ret = -EBUSY;
        }
-- 
1.8.3.1

Reply via email to