linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Thelen <gthelen@google.com>
To: Wu Fengguang <fengguang.wu@intel.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
	Minchan Kim <minchan.kim@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Dave Young <hidave.darkstar@gmail.com>,
	Andrea Righi <arighi@develer.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>,
	Balbir Singh <balbir@linux.vnet.ibm.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: memcg writeout throttling, was: [patch 4/4] memcg: use native word page statistics counters
Date: Mon, 8 Nov 2010 11:00:56 -0800	[thread overview]
Message-ID: <AANLkTim6ATcv_MOi0JJorH-wpTk1bUyyeAhbrUkyNimT@mail.gmail.com> (raw)
In-Reply-To: <20101108154524.GA9530@localhost>

On Mon, Nov 8, 2010 at 7:45 AM, Wu Fengguang <fengguang.wu@intel.com> wrote:
> On Mon, Nov 08, 2010 at 05:37:16PM +0800, Johannes Weiner wrote:
>> On Mon, Nov 08, 2010 at 09:07:35AM +0900, Minchan Kim wrote:
>> > BTW, let me ask a question.
>> > dirty_writeback_pages seems to be depends on mem_cgroup_page_stat's
>> > result(ie, negative) for separate global and memcg.
>> > But mem_cgroup_page_stat could return negative value by per-cpu as
>> > well as root cgroup.
>> > If I understand right, Isn't it a problem?
>>
>> Yes, the numbers are not reliable and may be off by some.  It appears
>> to me that the only sensible interpretation of a negative sum is to
>> assume zero, though.  So to be honest, I don't understand the fallback
>> to global state when the local state fluctuates around low values.
>
> Agreed. It does not make sense to compare values from different domains.
>
> The bdi stats use percpu_counter_sum_positive() which never return
> negative values. It may be suitable for memcg page counts, too.
>
>> This function is also only used in throttle_vm_writeout(), where the
>> outcome is compared to the global dirty threshold.  So using the
>> number of writeback pages _from the current cgroup_ and falling back
>> to global writeback pages when this number is low makes no sense to me
>> at all.
>>
>> I looks like it should rather compare the cgroup state with the cgroup
>> limit, and the global state with the global limit.
>
> Right.
>
>> Can somebody explain the reasoning behind this?  And in case it makes
>> sense after all, put a comment into this function?
>
> It seems a better match to test sc->mem_cgroup rather than
> mem_cgroup_from_task(current). The latter could make mismatches. When
> someone is changing the memcg limits and hence triggers memcg
> reclaims, the current task is actually the (unrelated) shell. It's
> also possible for the memcg task to trigger _global_ direct reclaim.

Good point.  I am writing a patch that will pass mem_cgroup from
sc->mem_cgroup into mem_cgroup_page_stat() rather than using
mem_cgroup_from_task(current).  I will post this patch in a few hours.

I will also fix the negative value issue in mem_cgroup_page_stat().

  reply	other threads:[~2010-11-08 19:01 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-05 16:08 [PATCH] memcg: use do_div to divide s64 in 32 bit machine Minchan Kim
2010-11-05 16:34 ` Greg Thelen
2010-11-06  1:03 ` hannes
2010-11-06 17:19   ` Greg Thelen
2010-11-06 17:31     ` Minchan Kim
2010-11-07 22:14     ` [patch 0/4] memcg: variable type fixes Johannes Weiner
2010-11-07 22:14     ` [patch 1/4] memcg: use native word to represent dirtyable pages Johannes Weiner
2010-11-07 22:56       ` Minchan Kim
2010-11-08 22:25         ` Greg Thelen
2010-11-08 22:38           ` Johannes Weiner
2010-11-08 22:43             ` Greg Thelen
2010-11-16  3:37       ` KAMEZAWA Hiroyuki
2010-11-07 22:14     ` [patch 2/4] memcg: catch negative per-cpu sums in dirty info Johannes Weiner
2010-11-07 23:26       ` Minchan Kim
2010-11-08 22:28         ` Greg Thelen
2010-11-16  3:39       ` KAMEZAWA Hiroyuki
2010-11-07 22:14     ` [patch 3/4] memcg: break out event counters from other stats Johannes Weiner
2010-11-07 23:52       ` Minchan Kim
2010-11-08 23:20         ` Greg Thelen
2010-11-16  3:41       ` KAMEZAWA Hiroyuki
2010-11-07 22:14     ` [patch 4/4] memcg: use native word page statistics counters Johannes Weiner
2010-11-08  0:01       ` Minchan Kim
2010-11-08  9:08         ` Johannes Weiner
2010-11-08 22:51         ` Greg Thelen
2010-11-08  0:07       ` Minchan Kim
2010-11-08  9:37         ` memcg writeout throttling, was: " Johannes Weiner
2010-11-08 15:45           ` Wu Fengguang
2010-11-08 19:00             ` Greg Thelen [this message]
2010-11-08 23:27       ` Greg Thelen
2010-11-08 23:45         ` Johannes Weiner
2010-11-16  3:44       ` KAMEZAWA Hiroyuki

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=AANLkTim6ATcv_MOi0JJorH-wpTk1bUyyeAhbrUkyNimT@mail.gmail.com \
    --to=gthelen@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=arighi@develer.com \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=fengguang.wu@intel.com \
    --cc=hannes@cmpxchg.org \
    --cc=hidave.darkstar@gmail.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan.kim@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).