From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: Minchan Kim <minchan.kim@gmail.com>
Cc: kosaki.motohiro@jp.fujitsu.com,
Johannes Weiner <hannes@cmpxchg.org>,
Rik van Riel <riel@redhat.com>, "Rafael J. Wysocki" <rjw@sisk.pl>,
"M. Vefa Bicakci" <bicave@superonline.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-mm <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [BUGFIX][PATCH] vmscan: don't use return value trick when oom_killer_disabled
Date: Thu, 2 Sep 2010 12:05:06 +0900 (JST) [thread overview]
Message-ID: <20100902115640.D071.A69D9226@jp.fujitsu.com> (raw)
In-Reply-To: <AANLkTiknTqHw11xRXNP4X-0yN1=rWyCh3MJV=HjRiZQJ@mail.gmail.com>
> > I don't want to send risky patch to -stable.
>
> Still I don't want to use oom_killer_disabled magic.
> But I don't want to prevent urgent stable patch due to my just nitpick.
>
> This is my last try(just quick patch, even I didn't tried compile test).
Looks like conceptually correct. If you will test it and fix whitespace damage,
I'll ack this one gladly.
Thanks.
> If this isn't good, first of all, let's try merge yours.
> And then we can fix it later.
>
> Thanks for comment.
>
> -- CUT HERE --
>
> Why do we check zone->all_unreclaimable in only kswapd?
> If kswapd is freezed in hibernation, OOM can happen.
> Let's the check in direct reclaim path, too.
>
>
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 3109ff7..41493ba 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -1878,12 +1878,11 @@ static void shrink_zone(int priority, struct zone *zone,
> * If a zone is deemed to be full of pinned pages then just give it a light
> * scan then give up on it.
> */
> -static bool shrink_zones(int priority, struct zonelist *zonelist,
> +static void shrink_zones(int priority, struct zonelist *zonelist,
> struct scan_control *sc)
> {
> struct zoneref *z;
> struct zone *zone;
> - bool all_unreclaimable = true;
>
> for_each_zone_zonelist_nodemask(zone, z, zonelist,
> gfp_zone(sc->gfp_mask), sc->nodemask) {
> @@ -1901,8 +1900,25 @@ static bool shrink_zones(int priority, struct
> zonelist *zonelist,
> }
>
> shrink_zone(priority, zone, sc);
> - all_unreclaimable = false;
> }
> +}
> +
> +static inline int all_unreclaimable(struct zonelist *zonelist, struct
> scan_control *sc)
> +{
> + struct zoneref *z;
> + struct zone *zone;
> + bool all_unreclaimable = true;
> +
> + for_each_zone_zonelist_nodemask(zone, z, zonelist,
> + gfp_zone(sc->gfp_mask), sc->nodemask) {
> + if (!populated_zone(zone))
> + continue;
> + if (zone->pages_scanned < (zone_reclaimable_pages(zone) * 6)) {
> + all_unreclaimable = false;
> + break;
> + }
> + }
> +
> return all_unreclaimable;
> }
>
> @@ -1926,7 +1942,6 @@ static unsigned long do_try_to_free_pages(struct
> zonelist *zonelist,
> struct scan_control *sc)
> {
> int priority;
> - bool all_unreclaimable;
> unsigned long total_scanned = 0;
> struct reclaim_state *reclaim_state = current->reclaim_state;
> struct zoneref *z;
> @@ -1943,7 +1958,7 @@ static unsigned long do_try_to_free_pages(struct
> zonelist *zonelist,
> sc->nr_scanned = 0;
> if (!priority)
> disable_swap_token();
> - all_unreclaimable = shrink_zones(priority, zonelist, sc);
> + shrink_zones(priority, zonelist, sc);
> /*
> * Don't shrink slabs when reclaiming memory from
> * over limit cgroups
> @@ -2005,7 +2020,7 @@ out:
> return sc->nr_reclaimed;
>
> /* top priority shrink_zones still had more to do? don't OOM, then */
> - if (scanning_global_lru(sc) && !all_unreclaimable)
> + if (scanning_global_lru(sc) && !all_unreclaimable(zonelist, sc))
> return 1;
>
> return 0;
>
>
> --
> Kind regards,
> Minchan Kim
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2010-09-02 3:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-01 0:31 KOSAKI Motohiro
2010-09-01 1:45 ` Minchan Kim
2010-09-01 1:55 ` KOSAKI Motohiro
2010-09-01 2:01 ` Minchan Kim
2010-09-01 15:56 ` Minchan Kim
2010-09-02 0:57 ` KOSAKI Motohiro
2010-09-02 2:55 ` Minchan Kim
2010-09-02 3:05 ` KOSAKI Motohiro [this message]
2010-09-02 3:18 ` 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=20100902115640.D071.A69D9226@jp.fujitsu.com \
--to=kosaki.motohiro@jp.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=bicave@superonline.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan.kim@gmail.com \
--cc=riel@redhat.com \
--cc=rjw@sisk.pl \
/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