diff --git a/mm/swap.c b/mm/swap.c index 30b6a37c74af..1fb25f8bb155 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -631,13 +631,15 @@ static void __lru_cache_add(struct page *page) */ void lru_cache_add_anon(struct page *page) { - ClearPageActive(page); + if (PageActive(page)) + ClearPageActive(page); __lru_cache_add(page); } void lru_cache_add_file(struct page *page) { - ClearPageActive(page); + if (PageActive(page)) + ClearPageActive(page); __lru_cache_add(page); } EXPORT_SYMBOL(lru_cache_add_file);