lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 16 Jun 2011 13:45:39 +0200
From:	Michal Hocko <mhocko@...e.cz>
To:	Ying Han <yinghan@...gle.com>
Cc:	Johannes Weiner <hannes@...xchg.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	Daisuke Nishimura <nishimura@....nes.nec.co.jp>,
	Balbir Singh <balbir@...ux.vnet.ibm.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Rik van Riel <riel@...hat.com>,
	Minchan Kim <minchan.kim@...il.com>,
	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
	Mel Gorman <mgorman@...e.de>, Greg Thelen <gthelen@...gle.com>,
	Michel Lespinasse <walken@...gle.com>,
	"linux-mm@...ck.org" <linux-mm@...ck.org>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [patch 4/8] memcg: rework soft limit reclaim

On Wed 15-06-11 15:57:59, Ying Han wrote:
> On Fri, Jun 10, 2011 at 12:36 AM, Michal Hocko <mhocko@...e.cz> wrote:
> > On Thu 09-06-11 17:00:26, Michal Hocko wrote:
> >> On Thu 02-06-11 22:25:29, Ying Han wrote:
> >> > On Thu, Jun 2, 2011 at 2:55 PM, Ying Han <yinghan@...gle.com> wrote:
> >> > > On Tue, May 31, 2011 at 11:25 PM, Johannes Weiner <hannes@...xchg.org> wrote:
> >> > >> Currently, soft limit reclaim is entered from kswapd, where it selects
> >> [...]
> >> > >> diff --git a/mm/vmscan.c b/mm/vmscan.c
> >> > >> index c7d4b44..0163840 100644
> >> > >> --- a/mm/vmscan.c
> >> > >> +++ b/mm/vmscan.c
> >> > >> @@ -1988,9 +1988,13 @@ static void shrink_zone(int priority, struct zone *zone,
> >> > >>                unsigned long reclaimed = sc->nr_reclaimed;
> >> > >>                unsigned long scanned = sc->nr_scanned;
> >> > >>                unsigned long nr_reclaimed;
> >> > >> +               int epriority = priority;
> >> > >> +
> >> > >> +               if (mem_cgroup_soft_limit_exceeded(root, mem))
> >> > >> +                       epriority -= 1;
> >> > >
> >> > > Here we grant the ability to shrink from all the memcgs, but only
> >> > > higher the priority for those exceed the soft_limit. That is a design
> >> > > change
> >> > > for the "soft_limit" which giving a hint to which memcgs to reclaim
> >> > > from first under global memory pressure.
> >> >
> >> >
> >> > Basically, we shouldn't reclaim from a memcg under its soft_limit
> >> > unless we have trouble reclaim pages from others.
> >>
> >> Agreed.
> >>
> >> > Something like the following makes better sense:
> >> >
> >> > diff --git a/mm/vmscan.c b/mm/vmscan.c
> >> > index bdc2fd3..b82ba8c 100644
> >> > --- a/mm/vmscan.c
> >> > +++ b/mm/vmscan.c
> >> > @@ -1989,6 +1989,8 @@ restart:
> >> >         throttle_vm_writeout(sc->gfp_mask);
> >> >  }
> >> >
> >> > +#define MEMCG_SOFTLIMIT_RECLAIM_PRIORITY       2
> >> > +
> >> >  static void shrink_zone(int priority, struct zone *zone,
> >> >                                 struct scan_control *sc)
> >> >  {
> >> > @@ -2001,13 +2003,13 @@ static void shrink_zone(int priority, struct zone *zone,
> >> >                 unsigned long reclaimed = sc->nr_reclaimed;
> >> >                 unsigned long scanned = sc->nr_scanned;
> >> >                 unsigned long nr_reclaimed;
> >> > -               int epriority = priority;
> >> >
> >> > -               if (mem_cgroup_soft_limit_exceeded(root, mem))
> >> > -                       epriority -= 1;
> >> > +               if (!mem_cgroup_soft_limit_exceeded(root, mem) &&
> >> > +                               priority > MEMCG_SOFTLIMIT_RECLAIM_PRIORITY)
> >> > +                       continue;
> >>
> >> yes, this makes sense but I am not sure about the right(tm) value of the
> >> MEMCG_SOFTLIMIT_RECLAIM_PRIORITY. 2 sounds too low.
> >
> > There is also another problem. I have just realized that this code path
> > is shared with the cgroup direct reclaim. We shouldn't care about soft
> > limit in such a situation. It would be just a wasting of cycles. So we
> > have to:
> >
> > if (current_is_kswapd() &&
> >        !mem_cgroup_soft_limit_exceeded(root, mem) &&
> >        priority > MEMCG_SOFTLIMIT_RECLAIM_PRIORITY)
> >        continue;
> 
> Agreed.
> 
> >
> > Maybe the condition would have to be more complex for per-cgroup
> > background reclaim, though.
> 
> That would be the same logic for per-memcg direct reclaim. In general,
> we don't consider soft_limit
> unless the global memory pressure. So the condition could be something like:
> 
> > if (   global_reclaim(sc) &&
> >        !mem_cgroup_soft_limit_exceeded(root, mem) &&
> >        priority > MEMCG_SOFTLIMIT_RECLAIM_PRIORITY)
> >        continue;
> 
> make sense?

Yes seems to be more consistent.

-- 
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9    
Czech Republic
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ