diff --git a/mm/vmscan.c b/mm/vmscan.c index 6b5a5fa76f35..098513613142 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1152,6 +1152,8 @@ static unsigned long shrink_page_list(struct list_head *page_list, goto keep; VM_BUG_ON_PAGE(PageActive(page), page); + if (pgdat) + VM_BUG_ON_PAGE(page_pgdat(page) != pgdat, page); nr_pages = compound_nr(page); @@ -1238,7 +1240,8 @@ static unsigned long shrink_page_list(struct list_head *page_list, /* Case 1 above */ if (current_is_kswapd() && PageReclaim(page) && - test_bit(PGDAT_WRITEBACK, &pgdat->flags)) { + (pgdat && + test_bit(PGDAT_WRITEBACK, &pgdat->flags))) { stat->nr_immediate++; goto activate_locked; @@ -1372,7 +1375,8 @@ static unsigned long shrink_page_list(struct list_head *page_list, */ if (page_is_file_cache(page) && (!current_is_kswapd() || !PageReclaim(page) || - !test_bit(PGDAT_DIRTY, &pgdat->flags))) { + (pgdat && + !test_bit(PGDAT_DIRTY, &pgdat->flags)))) { /* * Immediately reclaim when written back. * Similar in principal to deactivate_page()