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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALdu-PA09QKbL97dZHs1TZv-n=xDUyQvOXatSKOAHExKjfHS+Q@mail.gmail.com>
Date:	Sun, 4 Sep 2011 00:20:59 -0700
From:	Paul Menage <paul@...lmenage.org>
To:	"Kirill A. Shutemov" <kirill@...temov.name>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Balbir Singh <bsingharora@...il.com>,
	Daisuke Nishimura <nishimura@....nes.nec.co.jp>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
	linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] memcg: drain all stocks for the cgroup before read usage

On Sat, Sep 3, 2011 at 6:15 PM, Kirill A. Shutemov <kirill@...temov.name> wrote:
> From: "Kirill A. Shutemov" <kirill@...temov.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@...temov.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@...r.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 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