All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: Hillf Danton <dhillf@gmail.com>
Cc: linux-mm@kvack.org, Michal Hocko <mhocko@suse.cz>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Ying Han <yinghan@google.com>, Hugh Dickins <hughd@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: vmscan: check mem cgroup over reclaimed
Date: Tue, 24 Jan 2012 09:33:47 +0100	[thread overview]
Message-ID: <20120124083347.GC1660@cmpxchg.org> (raw)
In-Reply-To: <CAJd=RBDUK=LQVhQm_P3DO-bgWka=gK9cKUkm8esOaZs261EexA@mail.gmail.com>

On Mon, Jan 23, 2012 at 08:30:42PM +0800, Hillf Danton wrote:
> On Mon, Jan 23, 2012 at 6:47 PM, Johannes Weiner <hannes@cmpxchg.org> wrote:
> > On Mon, Jan 23, 2012 at 09:55:07AM +0800, Hillf Danton wrote:
> >> To avoid reduction in performance of reclaimee, checking overreclaim is added
> >> after shrinking lru list, when pages are reclaimed from mem cgroup.
> >>
> >> If over reclaim occurs, shrinking remaining lru lists is skipped, and no more
> >> reclaim for reclaim/compaction.
> >>
> >> Signed-off-by: Hillf Danton <dhillf@gmail.com>
> >> ---
> >>
> >> --- a/mm/vmscan.c     Mon Jan 23 00:23:10 2012
> >> +++ b/mm/vmscan.c     Mon Jan 23 09:57:20 2012
> >> @@ -2086,6 +2086,7 @@ static void shrink_mem_cgroup_zone(int p
> >>       unsigned long nr_reclaimed, nr_scanned;
> >>       unsigned long nr_to_reclaim = sc->nr_to_reclaim;
> >>       struct blk_plug plug;
> >> +     bool memcg_over_reclaimed = false;
> >>
> >>  restart:
> >>       nr_reclaimed = 0;
> >> @@ -2103,6 +2104,11 @@ restart:
> >>
> >>                               nr_reclaimed += shrink_list(lru, nr_to_scan,
> >>                                                           mz, sc, priority);
> >> +
> >> +                             memcg_over_reclaimed = !scanning_global_lru(mz)
> >> +                                     && (nr_reclaimed >= nr_to_reclaim);
> >> +                             if (memcg_over_reclaimed)
> >> +                                     goto out;
> >
> > Since this merge window, scanning_global_lru() is always false when
> > the memory controller is enabled, i.e. most common configurations and
> > distribution kernels.
> >
> > This will with quite likely have bad effects on zone balancing,
> > pressure balancing between anon/file lru etc, while you haven't shown
> > that any workloads actually benefit from this.
> >
> Hi Johannes
> 
> Thanks for your comment, first.
> 
> Impact on zone balance and lru-list balance is introduced actually, but I
> dont think the patch is totally responsible for the balance mentioned,
> because soft limit, embedded in mem cgroup, is setup by users according to
> whatever tastes they have.
> 
> Though there is room for the patch to be fine tuned in this direction or that,
> over reclaim should not be neglected entirely, but be avoided as much as we
> could, or users are enforced to set up soft limit with much care not to mess
> up zone balance.

Overreclaim is absolutely horrible with soft limits, but I think there
are more direct reasons than checking nr_to_reclaim only after a full
zone scan, for example, soft limit reclaim is invoked on zones that
are totally fine.

--
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>

WARNING: multiple messages have this Message-ID (diff)
From: Johannes Weiner <hannes@cmpxchg.org>
To: Hillf Danton <dhillf@gmail.com>
Cc: linux-mm@kvack.org, Michal Hocko <mhocko@suse.cz>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Ying Han <yinghan@google.com>, Hugh Dickins <hughd@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: vmscan: check mem cgroup over reclaimed
Date: Tue, 24 Jan 2012 09:33:47 +0100	[thread overview]
Message-ID: <20120124083347.GC1660@cmpxchg.org> (raw)
In-Reply-To: <CAJd=RBDUK=LQVhQm_P3DO-bgWka=gK9cKUkm8esOaZs261EexA@mail.gmail.com>

On Mon, Jan 23, 2012 at 08:30:42PM +0800, Hillf Danton wrote:
> On Mon, Jan 23, 2012 at 6:47 PM, Johannes Weiner <hannes@cmpxchg.org> wrote:
> > On Mon, Jan 23, 2012 at 09:55:07AM +0800, Hillf Danton wrote:
> >> To avoid reduction in performance of reclaimee, checking overreclaim is added
> >> after shrinking lru list, when pages are reclaimed from mem cgroup.
> >>
> >> If over reclaim occurs, shrinking remaining lru lists is skipped, and no more
> >> reclaim for reclaim/compaction.
> >>
> >> Signed-off-by: Hillf Danton <dhillf@gmail.com>
> >> ---
> >>
> >> --- a/mm/vmscan.c     Mon Jan 23 00:23:10 2012
> >> +++ b/mm/vmscan.c     Mon Jan 23 09:57:20 2012
> >> @@ -2086,6 +2086,7 @@ static void shrink_mem_cgroup_zone(int p
> >>       unsigned long nr_reclaimed, nr_scanned;
> >>       unsigned long nr_to_reclaim = sc->nr_to_reclaim;
> >>       struct blk_plug plug;
> >> +     bool memcg_over_reclaimed = false;
> >>
> >>  restart:
> >>       nr_reclaimed = 0;
> >> @@ -2103,6 +2104,11 @@ restart:
> >>
> >>                               nr_reclaimed += shrink_list(lru, nr_to_scan,
> >>                                                           mz, sc, priority);
> >> +
> >> +                             memcg_over_reclaimed = !scanning_global_lru(mz)
> >> +                                     && (nr_reclaimed >= nr_to_reclaim);
> >> +                             if (memcg_over_reclaimed)
> >> +                                     goto out;
> >
> > Since this merge window, scanning_global_lru() is always false when
> > the memory controller is enabled, i.e. most common configurations and
> > distribution kernels.
> >
> > This will with quite likely have bad effects on zone balancing,
> > pressure balancing between anon/file lru etc, while you haven't shown
> > that any workloads actually benefit from this.
> >
> Hi Johannes
> 
> Thanks for your comment, first.
> 
> Impact on zone balance and lru-list balance is introduced actually, but I
> dont think the patch is totally responsible for the balance mentioned,
> because soft limit, embedded in mem cgroup, is setup by users according to
> whatever tastes they have.
> 
> Though there is room for the patch to be fine tuned in this direction or that,
> over reclaim should not be neglected entirely, but be avoided as much as we
> could, or users are enforced to set up soft limit with much care not to mess
> up zone balance.

Overreclaim is absolutely horrible with soft limits, but I think there
are more direct reasons than checking nr_to_reclaim only after a full
zone scan, for example, soft limit reclaim is invoked on zones that
are totally fine.

  reply	other threads:[~2012-01-24  8:33 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-23  1:55 [PATCH] mm: vmscan: check mem cgroup over reclaimed Hillf Danton
2012-01-23  1:55 ` Hillf Danton
2012-01-23 10:47 ` Johannes Weiner
2012-01-23 10:47   ` Johannes Weiner
2012-01-23 12:30   ` Hillf Danton
2012-01-23 12:30     ` Hillf Danton
2012-01-24  8:33     ` Johannes Weiner [this message]
2012-01-24  8:33       ` Johannes Weiner
2012-01-24  9:08       ` KAMEZAWA Hiroyuki
2012-01-24  9:08         ` KAMEZAWA Hiroyuki
2012-01-24 23:33         ` Ying Han
2012-01-24 23:33           ` Ying Han
2012-01-26  9:16           ` KAMEZAWA Hiroyuki
2012-01-26  9:16             ` KAMEZAWA Hiroyuki
2012-01-23 19:04 ` Ying Han
2012-01-23 19:04   ` Ying Han
2012-01-24  3:45   ` Hillf Danton
2012-01-24  3:45     ` Hillf Danton
2012-01-24 23:22     ` Ying Han
2012-01-24 23:22       ` Ying Han
2012-01-25  1:47       ` Hillf Danton
2012-01-25  1:47         ` Hillf Danton
2012-01-25 19:20         ` Ying Han
2012-01-25 19:20           ` 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=20120124083347.GC1660@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=akpm@linux-foundation.org \
    --cc=dhillf@gmail.com \
    --cc=hughd@google.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.