All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Righi <arighi@develer.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Suleiman Souhlal <suleiman@google.com>,
	Greg Thelen <gthelen@google.com>,
	Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>,
	"Kirill A. Shutemov" <kirill@shutemov.name>,
	Andrew Morton <akpm@linux-foundation.org>,
	containers@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Trond Myklebust <trond.myklebust@fys.uio.no>
Subject: Re: [PATCH -mmotm 3/3] memcg: dirty pages instrumentation
Date: Wed, 3 Mar 2010 13:05:51 +0100	[thread overview]
Message-ID: <20100303120551.GB16239@linux> (raw)
In-Reply-To: <1267610855.25158.82.camel@laptop>

On Wed, Mar 03, 2010 at 11:07:35AM +0100, Peter Zijlstra wrote:
> On Tue, 2010-03-02 at 23:14 +0100, Andrea Righi wrote:
> > 
> > I agree mem_cgroup_has_dirty_limit() is nicer. But we must do that under
> > RCU, so something like:
> > 
> >         rcu_read_lock();
> >         if (mem_cgroup_has_dirty_limit())
> >                 mem_cgroup_get_page_stat()
> >         else
> >                 global_page_state()
> >         rcu_read_unlock();
> > 
> > That is bad when mem_cgroup_has_dirty_limit() always returns false
> > (e.g., when memory cgroups are disabled). So I fallback to the old
> > interface.
> 
> Why is it that mem_cgroup_has_dirty_limit() needs RCU when
> mem_cgroup_get_page_stat() doesn't? That is, simply make
> mem_cgroup_has_dirty_limit() not require RCU in the same way
> *_get_page_stat() doesn't either.

OK, I agree we can get rid of RCU protection here (see my previous
email).

BTW the point was that after mem_cgroup_has_dirty_limit() the task might
be moved to another cgroup, but also in this case mem_cgroup_has_dirty_limit()
will be always true, so mem_cgroup_get_page_stat() is always coherent.

> 
> > What do you think about:
> > 
> >         mem_cgroup_lock();
> >         if (mem_cgroup_has_dirty_limit())
> >                 mem_cgroup_get_page_stat()
> >         else
> >                 global_page_state()
> >         mem_cgroup_unlock();
> > 
> > Where mem_cgroup_read_lock/unlock() simply expand to nothing when
> > memory cgroups are disabled.
> 
> I think you're engineering the wrong way around.
> 
> > > 
> > > That allows for a 0 dirty limit (which should work and basically makes
> > > all io synchronous).
> > 
> > IMHO it is better to reserve 0 for the special value "disabled" like the
> > global settings. A synchronous IO can be also achieved using a dirty
> > limit of 1.
> 
> Why?! 0 clearly states no writeback cache, IOW sync writes, a 1
> byte/page writeback cache effectively reduces to the same thing, but its
> not the same thing conceptually. If you want to put the size and enable
> into a single variable pick -1 for disable or so.

I might agree, and actually I prefer this solution.. but in this way we
would use a different interface respect to the equivalent vm_dirty_ratio
/ vm_dirty_bytes global settings (as well as dirty_background_ratio /
dirty_background_bytes).

IMHO it's better to use the same interface to avoid user
misunderstandings.

Thanks,
-Andrea

WARNING: multiple messages have this Message-ID (diff)
From: Andrea Righi <arighi@develer.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Suleiman Souhlal <suleiman@google.com>,
	Greg Thelen <gthelen@google.com>,
	Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>,
	"Kirill A. Shutemov" <kirill@shutemov.name>,
	Andrew Morton <akpm@linux-foundation.org>,
	containers@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Trond Myklebust <trond.myklebust@fys.uio.no>
Subject: Re: [PATCH -mmotm 3/3] memcg: dirty pages instrumentation
Date: Wed, 3 Mar 2010 13:05:51 +0100	[thread overview]
Message-ID: <20100303120551.GB16239@linux> (raw)
In-Reply-To: <1267610855.25158.82.camel@laptop>

On Wed, Mar 03, 2010 at 11:07:35AM +0100, Peter Zijlstra wrote:
> On Tue, 2010-03-02 at 23:14 +0100, Andrea Righi wrote:
> > 
> > I agree mem_cgroup_has_dirty_limit() is nicer. But we must do that under
> > RCU, so something like:
> > 
> >         rcu_read_lock();
> >         if (mem_cgroup_has_dirty_limit())
> >                 mem_cgroup_get_page_stat()
> >         else
> >                 global_page_state()
> >         rcu_read_unlock();
> > 
> > That is bad when mem_cgroup_has_dirty_limit() always returns false
> > (e.g., when memory cgroups are disabled). So I fallback to the old
> > interface.
> 
> Why is it that mem_cgroup_has_dirty_limit() needs RCU when
> mem_cgroup_get_page_stat() doesn't? That is, simply make
> mem_cgroup_has_dirty_limit() not require RCU in the same way
> *_get_page_stat() doesn't either.

OK, I agree we can get rid of RCU protection here (see my previous
email).

BTW the point was that after mem_cgroup_has_dirty_limit() the task might
be moved to another cgroup, but also in this case mem_cgroup_has_dirty_limit()
will be always true, so mem_cgroup_get_page_stat() is always coherent.

> 
> > What do you think about:
> > 
> >         mem_cgroup_lock();
> >         if (mem_cgroup_has_dirty_limit())
> >                 mem_cgroup_get_page_stat()
> >         else
> >                 global_page_state()
> >         mem_cgroup_unlock();
> > 
> > Where mem_cgroup_read_lock/unlock() simply expand to nothing when
> > memory cgroups are disabled.
> 
> I think you're engineering the wrong way around.
> 
> > > 
> > > That allows for a 0 dirty limit (which should work and basically makes
> > > all io synchronous).
> > 
> > IMHO it is better to reserve 0 for the special value "disabled" like the
> > global settings. A synchronous IO can be also achieved using a dirty
> > limit of 1.
> 
> Why?! 0 clearly states no writeback cache, IOW sync writes, a 1
> byte/page writeback cache effectively reduces to the same thing, but its
> not the same thing conceptually. If you want to put the size and enable
> into a single variable pick -1 for disable or so.

I might agree, and actually I prefer this solution.. but in this way we
would use a different interface respect to the equivalent vm_dirty_ratio
/ vm_dirty_bytes global settings (as well as dirty_background_ratio /
dirty_background_bytes).

IMHO it's better to use the same interface to avoid user
misunderstandings.

Thanks,
-Andrea

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2010-03-03 12:05 UTC|newest]

Thread overview: 140+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-01 21:23 [PATCH -mmotm 0/3] memcg: per cgroup dirty limit (v3) Andrea Righi
2010-03-01 21:23 ` Andrea Righi
2010-03-01 21:23 ` [PATCH -mmotm 1/3] memcg: dirty memory documentation Andrea Righi
2010-03-01 21:23   ` Andrea Righi
     [not found] ` <1267478620-5276-1-git-send-email-arighi-vWjgImWzx8FBDgjK7y7TUQ@public.gmane.org>
2010-03-01 21:23   ` Andrea Righi
2010-03-01 21:23   ` [PATCH -mmotm 2/3] memcg: dirty pages accounting and limiting infrastructure Andrea Righi
2010-03-01 21:23   ` [PATCH -mmotm 3/3] memcg: dirty pages instrumentation Andrea Righi
2010-03-01 21:23 ` [PATCH -mmotm 2/3] memcg: dirty pages accounting and limiting infrastructure Andrea Righi
2010-03-01 21:23   ` Andrea Righi
2010-03-02  0:20   ` KAMEZAWA Hiroyuki
2010-03-02  0:20     ` KAMEZAWA Hiroyuki
2010-03-02 10:04   ` Kirill A. Shutemov
2010-03-02 10:04     ` Kirill A. Shutemov
2010-03-02 11:00     ` Andrea Righi
2010-03-02 11:00       ` Andrea Righi
     [not found]     ` <cc557aab1003020204k16038838ta537357aeeb67b11-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-03-02 11:00       ` Andrea Righi
     [not found]   ` <1267478620-5276-3-git-send-email-arighi-vWjgImWzx8FBDgjK7y7TUQ@public.gmane.org>
2010-03-02  0:20     ` KAMEZAWA Hiroyuki
2010-03-02 10:04     ` Kirill A. Shutemov
2010-03-02 13:02     ` Balbir Singh
2010-03-02 18:08     ` Greg Thelen
2010-03-02 13:02   ` Balbir Singh
2010-03-02 13:02     ` Balbir Singh
2010-03-02 21:50     ` Andrea Righi
2010-03-02 21:50       ` Andrea Righi
     [not found]     ` <20100302130223.GF3212-SINUvgVNF2CyUtPGxGje5AC/G2K4zDHf@public.gmane.org>
2010-03-02 21:50       ` Andrea Righi
2010-03-02 18:08   ` Greg Thelen
2010-03-02 18:08     ` Greg Thelen
2010-03-02 22:24     ` Andrea Righi
2010-03-02 22:24       ` Andrea Righi
     [not found]     ` <49b004811003021008t4fae71bbu8d56192e48c32f39-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-03-02 22:24       ` Andrea Righi
2010-03-01 21:23 ` [PATCH -mmotm 3/3] memcg: dirty pages instrumentation Andrea Righi
2010-03-01 21:23   ` Andrea Righi
2010-03-01 22:02   ` Vivek Goyal
2010-03-01 22:02     ` Vivek Goyal
2010-03-01 22:18     ` Andrea Righi
2010-03-01 22:18       ` Andrea Righi
2010-03-02 15:05       ` Vivek Goyal
2010-03-02 15:05       ` Vivek Goyal
2010-03-02 15:05         ` Vivek Goyal
2010-03-02 22:22         ` Andrea Righi
2010-03-02 22:22           ` Andrea Righi
2010-03-02 23:59           ` Vivek Goyal
2010-03-02 23:59           ` Vivek Goyal
2010-03-02 23:59             ` Vivek Goyal
2010-03-03 11:47             ` Andrea Righi
2010-03-03 11:47               ` Andrea Righi
2010-03-03 11:56               ` Andrea Righi
2010-03-03 11:56                 ` Andrea Righi
2010-03-03 11:56               ` Andrea Righi
     [not found]             ` <20100302235932.GA3007-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-03-03 11:47               ` Andrea Righi
     [not found]         ` <20100302150529.GA12855-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-03-02 22:22           ` Andrea Righi
     [not found]     ` <20100301220208.GH3109-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-03-01 22:18       ` Andrea Righi
2010-03-02  0:23   ` KAMEZAWA Hiroyuki
2010-03-02  0:23     ` KAMEZAWA Hiroyuki
     [not found]     ` <20100302092309.bff454d7.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2010-03-02  8:01       ` Andrea Righi
2010-03-02  8:01     ` Andrea Righi
2010-03-02  8:01       ` Andrea Righi
2010-03-02  8:12       ` Daisuke Nishimura
2010-03-02  8:12       ` Daisuke Nishimura
2010-03-02  8:12         ` Daisuke Nishimura
2010-03-02  8:23       ` KAMEZAWA Hiroyuki
2010-03-02  8:23         ` KAMEZAWA Hiroyuki
     [not found]         ` <20100302172316.b959b04c.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2010-03-02 13:50           ` Balbir Singh
2010-03-02 13:50         ` Balbir Singh
2010-03-02 13:50           ` Balbir Singh
2010-03-02 22:18           ` Andrea Righi
2010-03-02 22:18             ` Andrea Righi
2010-03-02 23:21             ` Daisuke Nishimura
2010-03-02 23:21               ` Daisuke Nishimura
2010-03-03 11:48               ` Andrea Righi
2010-03-03 11:48                 ` Andrea Righi
     [not found]               ` <20100303082107.a29562fa.nishimura-YQH0OdQVrdy45+QrQBaojngSJqDPrsil@public.gmane.org>
2010-03-03 11:48                 ` Andrea Righi
2010-03-02 23:21             ` Daisuke Nishimura
     [not found]           ` <20100302135026.GH3212-SINUvgVNF2CyUtPGxGje5AC/G2K4zDHf@public.gmane.org>
2010-03-02 22:18             ` Andrea Righi
2010-03-02  8:23       ` KAMEZAWA Hiroyuki
     [not found]   ` <1267478620-5276-4-git-send-email-arighi-vWjgImWzx8FBDgjK7y7TUQ@public.gmane.org>
2010-03-01 22:02     ` Vivek Goyal
2010-03-02  0:23     ` KAMEZAWA Hiroyuki
2010-03-02 10:11     ` Kirill A. Shutemov
2010-03-02 13:47     ` Balbir Singh
2010-03-02 13:48     ` Peter Zijlstra
2010-03-03  2:12     ` Daisuke Nishimura
2010-03-02 10:11   ` Kirill A. Shutemov
2010-03-02 10:11     ` Kirill A. Shutemov
2010-03-02 11:02     ` Andrea Righi
2010-03-02 11:02       ` Andrea Righi
2010-03-02 11:09       ` Kirill A. Shutemov
2010-03-02 11:09         ` Kirill A. Shutemov
     [not found]         ` <cc557aab1003020309y37587110i685d0d968bfba9f4-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-03-02 11:34           ` Andrea Righi
2010-03-02 11:34         ` Andrea Righi
2010-03-02 11:34           ` Andrea Righi
2010-03-02 11:09       ` Kirill A. Shutemov
     [not found]     ` <cc557aab1003020211h391947f0p3eae04a298127d32-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-03-02 11:02       ` Andrea Righi
2010-03-02 13:47   ` Balbir Singh
2010-03-02 13:47     ` Balbir Singh
2010-03-02 13:56     ` Kirill A. Shutemov
2010-03-02 13:56       ` Kirill A. Shutemov
     [not found]     ` <20100302134736.GG3212-SINUvgVNF2CyUtPGxGje5AC/G2K4zDHf@public.gmane.org>
2010-03-02 13:56       ` Kirill A. Shutemov
2010-03-02 13:48   ` Peter Zijlstra
2010-03-02 13:48     ` Peter Zijlstra
2010-03-02 15:26     ` Balbir Singh
2010-03-02 15:26     ` Balbir Singh
2010-03-02 15:26       ` Balbir Singh
2010-03-02 15:49     ` Trond Myklebust
2010-03-02 15:49       ` Trond Myklebust
2010-03-02 15:49     ` Trond Myklebust
2010-03-02 22:14     ` Andrea Righi
2010-03-02 22:14       ` Andrea Righi
2010-03-03 10:07       ` Peter Zijlstra
2010-03-03 10:07       ` Peter Zijlstra
2010-03-03 10:07         ` Peter Zijlstra
2010-03-03 12:05         ` Andrea Righi [this message]
2010-03-03 12:05           ` Andrea Righi
2010-03-03 12:05         ` Andrea Righi
2010-03-02 22:14     ` Andrea Righi
2010-03-03  2:12   ` Daisuke Nishimura
2010-03-03  2:12     ` Daisuke Nishimura
2010-03-03  3:29     ` KAMEZAWA Hiroyuki
2010-03-03  3:29       ` KAMEZAWA Hiroyuki
     [not found]       ` <20100303122906.9c613ab2.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2010-03-03  6:01         ` Daisuke Nishimura
2010-03-03  6:01       ` Daisuke Nishimura
2010-03-03  6:01         ` Daisuke Nishimura
2010-03-03  6:15         ` KAMEZAWA Hiroyuki
2010-03-03  6:15           ` KAMEZAWA Hiroyuki
2010-03-03  8:21           ` KAMEZAWA Hiroyuki
2010-03-03  8:21             ` KAMEZAWA Hiroyuki
2010-03-03 11:50             ` Andrea Righi
2010-03-03 11:50               ` Andrea Righi
2010-03-03 22:03             ` Andrea Righi
2010-03-03 22:03               ` Andrea Righi
2010-03-03 23:25               ` Daisuke Nishimura
2010-03-03 23:25                 ` Daisuke Nishimura
2010-03-03 23:25               ` Daisuke Nishimura
2010-03-04  3:45               ` KAMEZAWA Hiroyuki
2010-03-04  3:45               ` KAMEZAWA Hiroyuki
2010-03-04  3:45                 ` KAMEZAWA Hiroyuki
     [not found]             ` <20100303172132.fc6d9387.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2010-03-03 11:50               ` Andrea Righi
2010-03-03 22:03               ` Andrea Righi
     [not found]           ` <20100303151549.5d3d686a.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2010-03-03  8:21             ` KAMEZAWA Hiroyuki
     [not found]         ` <20100303150137.f56d7084.nishimura-YQH0OdQVrdy45+QrQBaojngSJqDPrsil@public.gmane.org>
2010-03-03  6:15           ` KAMEZAWA Hiroyuki
     [not found]     ` <20100303111238.7133f8af.nishimura-YQH0OdQVrdy45+QrQBaojngSJqDPrsil@public.gmane.org>
2010-03-03  3:29       ` 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=20100303120551.GB16239@linux \
    --to=arighi@develer.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=containers@lists.linux-foundation.org \
    --cc=gthelen@google.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 \
    --cc=peterz@infradead.org \
    --cc=suleiman@google.com \
    --cc=trond.myklebust@fys.uio.no \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.