diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memory-failure.c | 2 | ||||
-rw-r--r-- | mm/vmscan.c | 11 |
2 files changed, 5 insertions, 8 deletions
diff --git a/mm/memory-failure.c b/mm/memory-failure.c index ca96f411b034..f97d709594e6 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1473,6 +1473,8 @@ static int get_any_page(struct page *page, unsigned long pfn, int flags) */ ret = __get_any_page(page, pfn, 0); if (!PageLRU(page)) { + /* Drop page reference which is from __get_any_page() */ + put_page(page); pr_info("soft_offline: %#lx: unknown non LRU page type %lx\n", pfn, page->flags); return -EIO; diff --git a/mm/vmscan.c b/mm/vmscan.c index 13a4a39a1f4b..95c40daa21f2 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -773,20 +773,15 @@ static unsigned long shrink_page_list(struct list_head *page_list, * could easily OOM just because too many pages are in * writeback and there is nothing else to reclaim. * - * Check __GFP_IO, certainly because a loop driver + * Require may_enter_fs to wait on writeback, because + * fs may not have submitted IO yet. And a loop driver * thread might enter reclaim, and deadlock if it waits * on a page for which it is needed to do the write * (loop masks off __GFP_IO|__GFP_FS for this reason); * but more thought would probably show more reasons. - * - * Don't require __GFP_FS, since we're not going into - * the FS, just waiting on its writeback completion. - * Worryingly, ext4 gfs2 and xfs allocate pages with - * grab_cache_page_write_begin(,,AOP_FLAG_NOFS), so - * testing may_enter_fs here is liable to OOM on them. */ if (global_reclaim(sc) || - !PageReclaim(page) || !(sc->gfp_mask & __GFP_IO)) { + !PageReclaim(page) || !may_enter_fs) { /* * This is slightly racy - end_page_writeback() * might have just cleared PageReclaim, then |