linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Paul Menage <paul@paulmenage.org>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Balbir Singh <bsingharora@gmail.com>,
	Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] memcg: drain all stocks for the cgroup before read usage
Date: Sun, 4 Sep 2011 00:20:59 -0700	[thread overview]
Message-ID: <CALdu-PA09QKbL97dZHs1TZv-n=xDUyQvOXatSKOAHExKjfHS+Q@mail.gmail.com> (raw)
In-Reply-To: <1315098933-29464-1-git-send-email-kirill@shutemov.name>

On Sat, Sep 3, 2011 at 6:15 PM, Kirill A. Shutemov <kirill@shutemov.name> wrote:
> From: "Kirill A. Shutemov" <kirill@shutemov.name>
>
> Currently, mem_cgroup_usage() for non-root cgroup returns usage
> including stocks.
>
> Let's drain all socks before read resource counter value. It makes
> memory{,.memcg}.usage_in_bytes and memory.stat consistent.

Isn't that quite an expensive operation, and bear in mind that
resource control trackers may be reading this file very frequently,
maybe every second or so.

How about having a trigger file that can be written to force the drain
for cases where the consistency is really desired? Or a separate
usage_in_bytes_consistent file that does the drain.

Paul

>
> Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
> ---
>  mm/memcontrol.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index ebd1e86..e091022 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -3943,6 +3943,7 @@ static inline u64 mem_cgroup_usage(struct mem_cgroup *mem, bool swap)
>        u64 val;
>
>        if (!mem_cgroup_is_root(mem)) {
> +               drain_all_stock_sync(mem);
>                if (!swap)
>                        return res_counter_read_u64(&mem->res, RES_USAGE);
>                else
> --
> 1.7.5.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

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

  reply	other threads:[~2011-09-04  7:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-04  1:15 Kirill A. Shutemov
2011-09-04  7:20 ` Paul Menage [this message]
2011-09-04 23:59 ` KAMEZAWA Hiroyuki
2011-09-05  1:16   ` Daisuke Nishimura
2011-09-07 21:33     ` Kirill A. Shutemov
2011-09-08  0:19       ` KAMEZAWA Hiroyuki
2011-09-08  0:49         ` Kirill A. Shutemov
2011-09-08  9:21           ` KAMEZAWA Hiroyuki
2011-09-08 10:09           ` Johannes Weiner

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='CALdu-PA09QKbL97dZHs1TZv-n=xDUyQvOXatSKOAHExKjfHS+Q@mail.gmail.com' \
    --to=paul@paulmenage.org \
    --cc=akpm@linux-foundation.org \
    --cc=bsingharora@gmail.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nishimura@mxp.nes.nec.co.jp \
    /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