linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Shaohua Li <shaohua.li@intel.com>
To: Andrew Morton <akpm@google.com>
Cc: Michal Hocko <mhocko@suse.cz>, mel <mel@csn.ul.ie>,
	Rik van Riel <riel@redhat.com>, linux-mm <linux-mm@kvack.org>
Subject: [patch 1/2]vmscan: correct all_unreclaimable for zone without lru pages
Date: Tue, 27 Sep 2011 15:23:04 +0800	[thread overview]
Message-ID: <1317108184.29510.200.camel@sli10-conroe> (raw)

I saw DMA zone always has ->all_unreclaimable set. The reason is the high zones
are big, so zone_watermark_ok/_safe() will always return false with a high
classzone_idx for DMA zone, because DMA zone's lowmem_reserve is big for a high
classzone_idx. When kswapd runs into DMA zone, it doesn't scan/reclaim any
pages(no pages in lru), but mark the zone as all_unreclaimable. This can
happen in other low zones too.
This is confusing and can potentially cause oom. Say a low zone has
all_unreclaimable when high zone hasn't enough memory. Then allocating
some pages in low zone(for example reading blkdev with highmem support),
then run into direct reclaim. Since the zone has all_unreclaimable set,
direct reclaim might reclaim nothing and an oom reported. If
all_unreclaimable is unset, the zone can actually reclaim some pages.
If all_unreclaimable is unset, in the inner loop of balance_pgdat we always have
all_zones_ok 0 when checking a low zone's watermark. If high zone watermark isn't
good, there is no problem. Otherwise, we might loop one more time in the outer
loop, but since high zone watermark is ok, the end_zone will be lower, then low
zone's watermark check will be ok and the outer loop will break. So looks this
doesn't bring any problem.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>

---
 mm/vmscan.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: linux/mm/vmscan.c
===================================================================
--- linux.orig/mm/vmscan.c	2011-09-27 13:46:31.000000000 +0800
+++ linux/mm/vmscan.c	2011-09-27 15:09:29.000000000 +0800
@@ -2565,7 +2565,9 @@ loop_again:
 				sc.nr_reclaimed += reclaim_state->reclaimed_slab;
 				total_scanned += sc.nr_scanned;
 
-				if (nr_slab == 0 && !zone_reclaimable(zone))
+				if (nr_slab == 0 && !zone_reclaimable(zone) &&
+				    !zone_watermark_ok_safe(zone, order,
+				    high_wmark_pages(zone) + balance_gap, 0, 0))
 					zone->all_unreclaimable = 1;
 			}
 


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

             reply	other threads:[~2011-09-27  7:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-27  7:23 Shaohua Li [this message]
2011-09-27  9:28 ` [patch 1/2]vmscan: correct all_unreclaimable for zone without lru pages Michal Hocko
2011-09-28  0:46   ` Shaohua Li
2011-09-28  6:57 ` Minchan Kim
2011-09-28  7:08   ` Shaohua Li
2011-09-28 17:57     ` Minchan Kim
2011-09-29  1:14       ` Shaohua Li
2011-09-29  9:18         ` Minchan Kim
2011-09-30  2:12           ` Shaohua Li
2011-10-01  6:59             ` Minchan Kim
2011-10-08  3:09               ` Shaohua Li
2011-10-08  4:32                 ` Minchan Kim
2011-10-08  5:48                   ` Shaohua Li
2011-10-08  9:35                     ` Minchan Kim
2011-10-09  6:08                       ` Shaohua Li
2011-10-09  7:45                         ` Minchan Kim
2011-10-11  8:09                           ` KAMEZAWA Hiroyuki
2011-10-11  9:07                             ` Minchan Kim
2011-10-11  9:29                               ` KAMEZAWA Hiroyuki
2011-10-11  9:36                                 ` Minchan Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1317108184.29510.200.camel@sli10-conroe \
    --to=shaohua.li@intel.com \
    --cc=akpm@google.com \
    --cc=linux-mm@kvack.org \
    --cc=mel@csn.ul.ie \
    --cc=mhocko@suse.cz \
    --cc=riel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).