From: Michal Hocko <mhocko@suse.cz>
To: Kamezawa Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: linux-mm@kvack.org, Ying Han <yinghan@google.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Rik van Riel <riel@redhat.com>, Hugh Dickins <hughd@google.com>,
Mel Gorman <mgorman@suse.de>,
Glauber Costa <glommer@parallels.com>
Subject: Re: [RFC 1/3] memcg: integrate soft reclaim tighter with zone shrinking code
Date: Tue, 9 Apr 2013 19:05:38 +0200 [thread overview]
Message-ID: <20130409170538.GN29860@dhcp22.suse.cz> (raw)
In-Reply-To: <5164459F.1010903@jp.fujitsu.com>
On Wed 10-04-13 01:45:19, KAMEZAWA Hiroyuki wrote:
> (2013/04/09 21:13), Michal Hocko wrote:
[...]
> > @@ -1942,9 +1952,11 @@ static inline bool should_continue_reclaim(struct zone *zone,
> > }
> > }
> >
> > -static void shrink_zone(struct zone *zone, struct scan_control *sc)
> > +static unsigned
> > +__shrink_zone(struct zone *zone, struct scan_control *sc, bool soft_reclaim)
> > {
> > unsigned long nr_reclaimed, nr_scanned;
> > + unsigned nr_shrunk = 0;
>
> What does this number mean ?
number of groups that we called shrink_lruvec for.
> > do {
> > struct mem_cgroup *root = sc->target_mem_cgroup;
> > @@ -1961,6 +1973,13 @@ static void shrink_zone(struct zone *zone, struct scan_control *sc)
> > do {
> > struct lruvec *lruvec;
> >
> > + if (soft_reclaim &&
> > + !mem_cgroup_soft_reclaim_eligible(memcg)) {
> > + memcg = mem_cgroup_iter(root, memcg, &reclaim);
> > + continue;
> > + }
> > +
> > + nr_shrunk++;
> > lruvec = mem_cgroup_zone_lruvec(zone, memcg);
>
> nr_shrunk will be updated even if the memcg has no pages to be reclaimed...right ?
yes.
>
> >
> > shrink_lruvec(lruvec, sc);
> > @@ -1984,6 +2003,27 @@ static void shrink_zone(struct zone *zone, struct scan_control *sc)
> > } while (memcg);
> > } while (should_continue_reclaim(zone, sc->nr_reclaimed - nr_reclaimed,
> > sc->nr_scanned - nr_scanned, sc));
> > +
> > + return nr_shrunk;
> > +}
> > +
> > +
> > +static void shrink_zone(struct zone *zone, struct scan_control *sc)
> > +{
> > + bool do_soft_reclaim = mem_cgroup_should_soft_reclaim(sc);
> > + unsigned long nr_scanned = sc->nr_scanned;
> > + unsigned nr_shrunk;
> > +
> > + nr_shrunk = __shrink_zone(zone, sc, do_soft_reclaim);
> > +
> > + /*
> > + * No group is over the soft limit or those that are do not have
> > + * pages in the zone we are reclaiming so we have to reclaim everybody
> > + */
> > + if (do_soft_reclaim && (!nr_shrunk || sc->nr_scanned == nr_scanned)) {
> > + __shrink_zone(zone, sc, false);
> > + return;
> > + }
>
> Hmm...so...nr_shrunk is working as a bool value. Isn't it better to call
> __shrink_zone(...,false) if above shrink_zone(...,true) couldn't make
> good progress ?
Yes that was an attempt and as Johannes already pointed out nr_shrunk is
superseded by nr_scanned check
> memory-disk ping-pong will happen in bad case.
I am not sure what you mean by this.
> I think....in the 1st run, you can count amount of pages, which are
> candidates to be reclaimed. Then, you can compare the amounts of
> reclaim target and the priority and size of the target (amounts of
> reclaimable memory on the target zonelist), make a decision to fallback to
> full global reclaim or not.
I would like to keep the logic as simple as possible. nr_scanned
progress is a protection from increasing the priority and should be
sufficient for starter. There is still possibility that a small groups
over their soft limit won't have any pages to reclaim because those are
dirty but those pages should be flushed during the global reclaim and we
wait for them during targeted reclaim.
But I agree that maybe we need also a priority check here. Will think
about it.
>
> Thanks,
> -Kame
>
--
Michal Hocko
SUSE Labs
--
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:[~2013-04-09 17:05 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-09 12:13 [RFC 0/3] soft reclaim rework Michal Hocko
2013-04-09 12:13 ` [RFC 1/3] memcg: integrate soft reclaim tighter with zone shrinking code Michal Hocko
2013-04-09 13:08 ` Johannes Weiner
2013-04-09 13:31 ` Michal Hocko
2013-04-09 13:57 ` Glauber Costa
2013-04-09 14:22 ` Michal Hocko
2013-04-09 16:45 ` Kamezawa Hiroyuki
2013-04-09 17:05 ` Michal Hocko [this message]
2013-04-14 0:42 ` Mel Gorman
2013-04-14 14:34 ` Michal Hocko
2013-04-14 14:55 ` Johannes Weiner
2013-04-14 15:04 ` Michal Hocko
2013-04-14 15:11 ` Michal Hocko
2013-04-14 18:03 ` Rik van Riel
2013-04-09 12:13 ` [RFC 2/3] memcg: Ignore soft limit until it is explicitly specified Michal Hocko
2013-04-09 13:24 ` Johannes Weiner
2013-04-09 13:42 ` Michal Hocko
2013-04-09 17:10 ` Kamezawa Hiroyuki
2013-04-09 17:22 ` Michal Hocko
2013-04-09 12:13 ` [RFC 3/3] vmscan, memcg: Do softlimit reclaim also for targeted reclaim Michal Hocko
2013-04-22 2:14 ` Michal Hocko
2013-04-09 15:37 ` [RFC 0/3] soft reclaim rework Michal Hocko
2013-04-09 15:50 ` Michal Hocko
2013-04-11 8:43 ` Michal Hocko
2013-04-11 9:07 ` Michal Hocko
2013-04-11 13:04 ` Michal Hocko
2013-04-17 22:52 ` Ying Han
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=20130409170538.GN29860@dhcp22.suse.cz \
--to=mhocko@suse.cz \
--cc=glommer@parallels.com \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=riel@redhat.com \
--cc=yinghan@google.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