diff options
author | Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> | 2013-07-31 16:53:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-31 17:41:03 -0400 |
commit | ef2a2cbdda7e9d084a85846770fcc844958881f6 (patch) | |
tree | 8942f9f69822e234bb0c2da6e0ccc0756ed2d27b /mm | |
parent | 31a1b26f16e822577def5402ffc79cfe4aed2db9 (diff) |
mm/swap.c: clear PageActive before adding pages onto unevictable list
As a result of commit 13f7f78981e4 ("mm: pagevec: defer deciding which
LRU to add a page to until pagevec drain time"), pages on unevictable
lists can have both of PageActive and PageUnevictable set. This is not
only confusing, but also corrupts page migration and
shrink_[in]active_list.
This patch fixes the problem by adding ClearPageActive before adding
pages into unevictable list. It also cleans up VM_BUG_ONs.
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/swap.c | 9 |
1 files changed, 2 insertions, 7 deletions
@@ -512,12 +512,7 @@ EXPORT_SYMBOL(__lru_cache_add); | |||
512 | */ | 512 | */ |
513 | void lru_cache_add(struct page *page) | 513 | void 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); |
@@ -833,7 +829,6 @@ static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec, | |||
833 | int active = PageActive(page); | 829 | int active = PageActive(page); |
834 | enum lru_list lru = page_lru(page); | 830 | enum lru_list lru = page_lru(page); |
835 | 831 | ||
836 | VM_BUG_ON(PageUnevictable(page)); | ||
837 | VM_BUG_ON(PageLRU(page)); | 832 | VM_BUG_ON(PageLRU(page)); |
838 | 833 | ||
839 | SetPageLRU(page); | 834 | SetPageLRU(page); |