aboutsummaryrefslogtreecommitdiffstats
path: root/mm/swap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/swap.c')
-rw-r--r--mm/swap.c29
1 files changed, 4 insertions, 25 deletions
diff --git a/mm/swap.c b/mm/swap.c
index 4a1d0d2c52fa..62b78a6e224f 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -512,12 +512,7 @@ EXPORT_SYMBOL(__lru_cache_add);
512 */ 512 */
513void lru_cache_add(struct page *page) 513void lru_cache_add(struct page *page)
514{ 514{
515 if (PageActive(page)) { 515 VM_BUG_ON(PageActive(page) && PageUnevictable(page));
516 VM_BUG_ON(PageUnevictable(page));
517 } else if (PageUnevictable(page)) {
518 VM_BUG_ON(PageActive(page));
519 }
520
521 VM_BUG_ON(PageLRU(page)); 516 VM_BUG_ON(PageLRU(page));
522 __lru_cache_add(page); 517 __lru_cache_add(page);
523} 518}
@@ -539,6 +534,7 @@ void add_page_to_unevictable_list(struct page *page)
539 534
540 spin_lock_irq(&zone->lru_lock); 535 spin_lock_irq(&zone->lru_lock);
541 lruvec = mem_cgroup_page_lruvec(page, zone); 536 lruvec = mem_cgroup_page_lruvec(page, zone);
537 ClearPageActive(page);
542 SetPageUnevictable(page); 538 SetPageUnevictable(page);
543 SetPageLRU(page); 539 SetPageLRU(page);
544 add_page_to_lru_list(page, lruvec, LRU_UNEVICTABLE); 540 add_page_to_lru_list(page, lruvec, LRU_UNEVICTABLE);
@@ -774,8 +770,6 @@ EXPORT_SYMBOL(__pagevec_release);
774void lru_add_page_tail(struct page *page, struct page *page_tail, 770void lru_add_page_tail(struct page *page, struct page *page_tail,
775 struct lruvec *lruvec, struct list_head *list) 771 struct lruvec *lruvec, struct list_head *list)
776{ 772{
777 int uninitialized_var(active);
778 enum lru_list lru;
779 const int file = 0; 773 const int file = 0;
780 774
781 VM_BUG_ON(!PageHead(page)); 775 VM_BUG_ON(!PageHead(page));
@@ -787,20 +781,6 @@ void lru_add_page_tail(struct page *page, struct page *page_tail,
787 if (!list) 781 if (!list)
788 SetPageLRU(page_tail); 782 SetPageLRU(page_tail);
789 783
790 if (page_evictable(page_tail)) {
791 if (PageActive(page)) {
792 SetPageActive(page_tail);
793 active = 1;
794 lru = LRU_ACTIVE_ANON;
795 } else {
796 active = 0;
797 lru = LRU_INACTIVE_ANON;
798 }
799 } else {
800 SetPageUnevictable(page_tail);
801 lru = LRU_UNEVICTABLE;
802 }
803
804 if (likely(PageLRU(page))) 784 if (likely(PageLRU(page)))
805 list_add_tail(&page_tail->lru, &page->lru); 785 list_add_tail(&page_tail->lru, &page->lru);
806 else if (list) { 786 else if (list) {
@@ -816,13 +796,13 @@ void lru_add_page_tail(struct page *page, struct page *page_tail,
816 * Use the standard add function to put page_tail on the list, 796 * Use the standard add function to put page_tail on the list,
817 * but then correct its position so they all end up in order. 797 * but then correct its position so they all end up in order.
818 */ 798 */
819 add_page_to_lru_list(page_tail, lruvec, lru); 799 add_page_to_lru_list(page_tail, lruvec, page_lru(page_tail));
820 list_head = page_tail->lru.prev; 800 list_head = page_tail->lru.prev;
821 list_move_tail(&page_tail->lru, list_head); 801 list_move_tail(&page_tail->lru, list_head);
822 } 802 }
823 803
824 if (!PageUnevictable(page)) 804 if (!PageUnevictable(page))
825 update_page_reclaim_stat(lruvec, file, active); 805 update_page_reclaim_stat(lruvec, file, PageActive(page_tail));
826} 806}
827#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ 807#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
828 808
@@ -833,7 +813,6 @@ static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec,
833 int active = PageActive(page); 813 int active = PageActive(page);
834 enum lru_list lru = page_lru(page); 814 enum lru_list lru = page_lru(page);
835 815
836 VM_BUG_ON(PageUnevictable(page));
837 VM_BUG_ON(PageLRU(page)); 816 VM_BUG_ON(PageLRU(page));
838 817
839 SetPageLRU(page); 818 SetPageLRU(page);