diff options
-rw-r--r-- | mm/vmscan.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c index 88804017e7d6..ca43aa00ea0e 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -720,9 +720,26 @@ static unsigned long shrink_page_list(struct list_head *page_list, | |||
720 | (PageSwapCache(page) && (sc->gfp_mask & __GFP_IO)); | 720 | (PageSwapCache(page) && (sc->gfp_mask & __GFP_IO)); |
721 | 721 | ||
722 | if (PageWriteback(page)) { | 722 | if (PageWriteback(page)) { |
723 | nr_writeback++; | 723 | /* |
724 | unlock_page(page); | 724 | * memcg doesn't have any dirty pages throttling so we |
725 | goto keep; | 725 | * could easily OOM just because too many pages are in |
726 | * writeback from reclaim and there is nothing else to | ||
727 | * reclaim. | ||
728 | * | ||
729 | * Check may_enter_fs, certainly because a loop driver | ||
730 | * thread might enter reclaim, and deadlock if it waits | ||
731 | * on a page for which it is needed to do the write | ||
732 | * (loop masks off __GFP_IO|__GFP_FS for this reason); | ||
733 | * but more thought would probably show more reasons. | ||
734 | */ | ||
735 | if (!global_reclaim(sc) && PageReclaim(page) && | ||
736 | may_enter_fs) | ||
737 | wait_on_page_writeback(page); | ||
738 | else { | ||
739 | nr_writeback++; | ||
740 | unlock_page(page); | ||
741 | goto keep; | ||
742 | } | ||
726 | } | 743 | } |
727 | 744 | ||
728 | references = page_check_references(page, sc); | 745 | references = page_check_references(page, sc); |