linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ying Han <yinghan@google.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Pavel Emelyanov <xemul@openvz.org>,
	Balbir Singh <balbir@linux.vnet.ibm.com>,
	Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>,
	Li Zefan <lizf@cn.fujitsu.com>, Mel Gorman <mel@csn.ul.ie>,
	Christoph Lameter <cl@linux.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Rik van Riel <riel@redhat.com>, Hugh Dickins <hughd@google.com>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Tejun Heo <tj@kernel.org>, Michal Hocko <mhocko@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	Dave Hansen <dave@linux.vnet.ibm.com>,
	linux-mm@kvack.org
Subject: Re: [PATCH V3 3/7] New APIs to adjust per-memcg wmarks
Date: Wed, 13 Apr 2011 11:46:58 -0700	[thread overview]
Message-ID: <BANLkTi=CxcVBKrSSbUGsGGsy-5jwgZnc+g@mail.gmail.com> (raw)
In-Reply-To: <20110413173036.0756873d.kamezawa.hiroyu@jp.fujitsu.com>

[-- Attachment #1: Type: text/plain, Size: 4812 bytes --]

On Wed, Apr 13, 2011 at 1:30 AM, KAMEZAWA Hiroyuki <
kamezawa.hiroyu@jp.fujitsu.com> wrote:

> On Wed, 13 Apr 2011 00:03:03 -0700
> Ying Han <yinghan@google.com> wrote:
>
> > Add wmark_ratio and reclaim_wmarks APIs per-memcg. The wmark_ratio
> > adjusts the internal low/high wmark calculation and the reclaim_wmarks
> > exports the current value of watermarks. By default, the wmark_ratio is
> > set to 0 and the watermarks are equal to the hard_limit(limit_in_bytes).
> >
> > $ cat /dev/cgroup/A/memory.wmark_ratio
> > 0
> >
> > $ cat /dev/cgroup/A/memory.limit_in_bytes
> > 524288000
> >
> > $ echo 80 >/dev/cgroup/A/memory.wmark_ratio
> >
> > $ cat /dev/cgroup/A/memory.reclaim_wmarks
> > low_wmark 393216000
> > high_wmark 419430400
> >
>
> I think havig _ratio_ will finally leads us to a tragedy as dirty_ratio,
> a complicated interface.
>
> For memcg, I'd like to have only _bytes.
>
> And, as I wrote in previous mail, how about setting _distance_ ?
>
>   memory.low_wmark_distance_in_bytes .... # hard_limit - low_wmark.
>   memory.high_wmark_distance_in_bytes ... # hard_limit - high_wmark.
>
> Anwyay, percent is too big unit.
>

Replied to your comment on "Add per memcg reclaim watermarks". I have no
problem to make the
wmark individual tunable. One thing to confirm before making the change is
to have:


memory.low_wmark_distance_in_bytes .... # min(hard_limit, soft_limit) -
> low_wmark
> memory.high_wmark_distance_in_bytes ... # min(hard_limit, soft_limit) -
> high_wmark.
>

And also, some checks on soft_limit are needed. If "soft_limit" == 0, use
hard_limit

--Ying


> Thanks,
> -Kame
>
>
> > changelog v3..v2:
> > 1. replace the "min_free_kbytes" api with "wmark_ratio". This is part of
> > feedbacks
> >
> > Signed-off-by: Ying Han <yinghan@google.com>
> > ---
> >  mm/memcontrol.c |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
> >  1 files changed, 49 insertions(+), 0 deletions(-)
> >
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index 664cdc5..36ae377 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -3983,6 +3983,31 @@ static int mem_cgroup_swappiness_write(struct
> cgroup *cgrp, struct cftype *cft,
> >       return 0;
> >  }
> >
> > +static u64 mem_cgroup_wmark_ratio_read(struct cgroup *cgrp, struct
> cftype *cft)
> > +{
> > +     struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
> > +
> > +     return get_wmark_ratio(memcg);
> > +}
> > +
> > +static int mem_cgroup_wmark_ratio_write(struct cgroup *cgrp, struct
> cftype *cfg,
> > +                                  u64 val)
> > +{
> > +     struct mem_cgroup *memcg = mem_cgroup_from_cont(cgrp);
> > +     struct mem_cgroup *parent;
> > +
> > +     if (cgrp->parent == NULL)
> > +             return -EINVAL;
> > +
> > +     parent = mem_cgroup_from_cont(cgrp->parent);
> > +
> > +     memcg->wmark_ratio = val;
> > +
> > +     setup_per_memcg_wmarks(memcg);
> > +     return 0;
> > +
> > +}
> > +
> >  static void __mem_cgroup_threshold(struct mem_cgroup *memcg, bool swap)
> >  {
> >       struct mem_cgroup_threshold_ary *t;
> > @@ -4274,6 +4299,21 @@ static void mem_cgroup_oom_unregister_event(struct
> cgroup *cgrp,
> >       mutex_unlock(&memcg_oom_mutex);
> >  }
> >
> > +static int mem_cgroup_wmark_read(struct cgroup *cgrp,
> > +     struct cftype *cft,  struct cgroup_map_cb *cb)
> > +{
> > +     struct mem_cgroup *mem = mem_cgroup_from_cont(cgrp);
> > +     u64 low_wmark, high_wmark;
> > +
> > +     low_wmark = res_counter_read_u64(&mem->res, RES_LOW_WMARK_LIMIT);
> > +     high_wmark = res_counter_read_u64(&mem->res, RES_HIGH_WMARK_LIMIT);
> > +
> > +     cb->fill(cb, "low_wmark", low_wmark);
> > +     cb->fill(cb, "high_wmark", high_wmark);
> > +
> > +     return 0;
> > +}
> > +
> >  static int mem_cgroup_oom_control_read(struct cgroup *cgrp,
> >       struct cftype *cft,  struct cgroup_map_cb *cb)
> >  {
> > @@ -4377,6 +4417,15 @@ static struct cftype mem_cgroup_files[] = {
> >               .unregister_event = mem_cgroup_oom_unregister_event,
> >               .private = MEMFILE_PRIVATE(_OOM_TYPE, OOM_CONTROL),
> >       },
> > +     {
> > +             .name = "wmark_ratio",
> > +             .write_u64 = mem_cgroup_wmark_ratio_write,
> > +             .read_u64 = mem_cgroup_wmark_ratio_read,
> > +     },
> > +     {
> > +             .name = "reclaim_wmarks",
> > +             .read_map = mem_cgroup_wmark_read,
> > +     },
> >  };
> >
> >  #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
> > --
> > 1.7.3.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>
> >
>
>

[-- Attachment #2: Type: text/html, Size: 6802 bytes --]

  reply	other threads:[~2011-04-13 18:47 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-13  7:03 [PATCH V3 0/7] memcg: per cgroup background reclaim Ying Han
2011-04-13  7:03 ` [PATCH V3 1/7] Add kswapd descriptor Ying Han
2011-04-13  7:03 ` [PATCH V3 2/7] Add per memcg reclaim watermarks Ying Han
2011-04-13  8:25   ` KAMEZAWA Hiroyuki
2011-04-13 18:40     ` Ying Han
2011-04-14  0:27       ` KAMEZAWA Hiroyuki
2011-04-14  8:24   ` Zhu Yanhai
2011-04-14 17:43     ` Ying Han
2011-04-13  7:03 ` [PATCH V3 3/7] New APIs to adjust per-memcg wmarks Ying Han
2011-04-13  8:30   ` KAMEZAWA Hiroyuki
2011-04-13 18:46     ` Ying Han [this message]
2011-04-13  7:03 ` [PATCH V3 4/7] Infrastructure to support per-memcg reclaim Ying Han
2011-04-14  3:57   ` Zhu Yanhai
2011-04-14  6:32     ` Ying Han
2011-04-13  7:03 ` [PATCH V3 5/7] Per-memcg background reclaim Ying Han
2011-04-13  8:58   ` KAMEZAWA Hiroyuki
2011-04-13 22:45     ` Ying Han
2011-04-13  7:03 ` [PATCH V3 6/7] Enable per-memcg " Ying Han
2011-04-13  9:05   ` KAMEZAWA Hiroyuki
2011-04-13 21:20     ` Ying Han
2011-04-14  0:30       ` KAMEZAWA Hiroyuki
2011-04-13  7:03 ` [PATCH V3 7/7] Add some per-memcg stats Ying Han
2011-04-13  7:47 ` [PATCH V3 0/7] memcg: per cgroup background reclaim KAMEZAWA Hiroyuki
2011-04-13 17:53   ` Ying Han
2011-04-14  0:14     ` KAMEZAWA Hiroyuki
2011-04-14 17:38       ` Ying Han
2011-04-14 21:59         ` 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='BANLkTi=CxcVBKrSSbUGsGGsy-5jwgZnc+g@mail.gmail.com' \
    --to=yinghan@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=cl@linux.com \
    --cc=dave@linux.vnet.ibm.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mel@csn.ul.ie \
    --cc=mhocko@suse.cz \
    --cc=nishimura@mxp.nes.nec.co.jp \
    --cc=riel@redhat.com \
    --cc=tj@kernel.org \
    --cc=xemul@openvz.org \
    /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).