]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - mm/swap.c
mm: collect LRU list heads into struct lruvec
[karo-tx-linux.git] / mm / swap.c
index a91caf754d9badb5f0b1f3c54b8e86be4723ff84..76ef79d3857c6252eb390ed08af0055f6171bb48 100644 (file)
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -236,7 +236,7 @@ static void pagevec_move_tail_fn(struct page *page, void *arg)
 
        if (PageLRU(page) && !PageActive(page) && !PageUnevictable(page)) {
                enum lru_list lru = page_lru_base_type(page);
-               list_move_tail(&page->lru, &zone->lru[lru].list);
+               list_move_tail(&page->lru, &zone->lruvec.lists[lru]);
                mem_cgroup_rotate_reclaimable_page(page);
                (*pgmoved)++;
        }
@@ -480,7 +480,7 @@ static void lru_deactivate_fn(struct page *page, void *arg)
                 * The page's writeback ends up during pagevec
                 * We moves tha page into tail of inactive.
                 */
-               list_move_tail(&page->lru, &zone->lru[lru].list);
+               list_move_tail(&page->lru, &zone->lruvec.lists[lru]);
                mem_cgroup_rotate_reclaimable_page(page);
                __count_vm_event(PGROTATED);
        }
@@ -585,11 +585,10 @@ int lru_add_drain_all(void)
 void release_pages(struct page **pages, int nr, int cold)
 {
        int i;
-       struct pagevec pages_to_free;
+       LIST_HEAD(pages_to_free);
        struct zone *zone = NULL;
        unsigned long uninitialized_var(flags);
 
-       pagevec_init(&pages_to_free, cold);
        for (i = 0; i < nr; i++) {
                struct page *page = pages[i];
 
@@ -620,19 +619,12 @@ void release_pages(struct page **pages, int nr, int cold)
                        del_page_from_lru(zone, page);
                }
 
-               if (!pagevec_add(&pages_to_free, page)) {
-                       if (zone) {
-                               spin_unlock_irqrestore(&zone->lru_lock, flags);
-                               zone = NULL;
-                       }
-                       __pagevec_free(&pages_to_free);
-                       pagevec_reinit(&pages_to_free);
-               }
+               list_add(&page->lru, &pages_to_free);
        }
        if (zone)
                spin_unlock_irqrestore(&zone->lru_lock, flags);
 
-       pagevec_free(&pages_to_free);
+       free_hot_cold_page_list(&pages_to_free, cold);
 }
 EXPORT_SYMBOL(release_pages);
 
@@ -662,7 +654,6 @@ void lru_add_page_tail(struct zone* zone,
        int active;
        enum lru_list lru;
        const int file = 0;
-       struct list_head *head;
 
        VM_BUG_ON(!PageHead(page));
        VM_BUG_ON(PageCompound(page_tail));
@@ -682,10 +673,10 @@ void lru_add_page_tail(struct zone* zone,
                }
                update_page_reclaim_stat(zone, page_tail, file, active);
                if (likely(PageLRU(page)))
-                       head = page->lru.prev;
+                       __add_page_to_lru_list(zone, page_tail, lru,
+                                              page->lru.prev);
                else
-                       head = &zone->lru[lru].list;
-               __add_page_to_lru_list(zone, page_tail, lru, head);
+                       add_page_to_lru_list(zone, page_tail, lru);
        } else {
                SetPageUnevictable(page_tail);
                add_page_to_lru_list(zone, page_tail, LRU_UNEVICTABLE);