Re: [PATCH v3 11/11] memcg: check memcg dirty limits in page writeback

Daisuke Nishimura
2010-10-20T04:45:03Z

On Wed, 20 Oct 2010 13:18:57 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:

> On Tue, 19 Oct 2010 10:00:15 +0900
> KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
>
> > On Mon, 18 Oct 2010 17:39:44 -0700
> > Greg Thelen <gthelen@google.com> wrote:
> >
> > > If the current process is in a non-root memcg, then
> > > global_dirty_limits() will consider the memcg dirty limit.
> > > This allows different cgroups to have distinct dirty limits
> > > which trigger direct and background writeback at different
> > > levels.
> > >
> > > Signed-off-by: Andrea Righi <arighi@develer.com>
> > > Signed-off-by: Greg Thelen <gthelen@google.com>
> >
> > Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> >
> Why FREEPAGES in memcg is not counted as dirtyable ?
>
It's counted as memcg_hierarchical_free_pages() in mem_cgroup_page_stat().
As for FREEPAGES, we should count ancestors, not children.

mem_cgroup_page_stat():
1311 if (mem && !mem_cgroup_is_root(mem)) {
1312 /*
1313 * If we're looking for dirtyable pages we need to evaluate
1314 * free pages depending on the limit and usage of the parents
1315 * first of all.
1316 */
1317 if (item == MEMCG_NR_DIRTYABLE_PAGES)
1318 value = memcg_hierarchical_free_pages(mem);
1319 else
1320 value = 0;
1321 /*
1322 * Recursively evaluate page statistics against all cgroup
1323 * under hierarchy tree
1324 */
1325 for_each_mem_cgroup_tree(iter, mem)
1326 value += mem_cgroup_local_page_stat(iter, item);