From: Andrea Righi <arighi@develer.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>,
Balbir Singh <balbir@linux.vnet.ibm.com>,
Vivek Goyal <vgoyal@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Trond Myklebust <trond.myklebust@fys.uio.no>,
Suleiman Souhlal <suleiman@google.com>,
Greg Thelen <gthelen@google.com>,
"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
Subject: Re: [PATCH -mmotm 3/4] memcg: dirty pages accounting and limiting infrastructure
Date: Fri, 5 Mar 2010 23:14:56 +0100 [thread overview]
Message-ID: <20100305221456.GB1578@linux> (raw)
In-Reply-To: <20100305105855.9b53176c.kamezawa.hiroyu@jp.fujitsu.com>
On Fri, Mar 05, 2010 at 10:58:55AM +0900, KAMEZAWA Hiroyuki wrote:
> On Fri, 5 Mar 2010 10:12:34 +0900
> Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> wrote:
>
> > On Thu, 4 Mar 2010 11:40:14 +0100, Andrea Righi <arighi@develer.com> wrote:
> > > Infrastructure to account dirty pages per cgroup and add dirty limit
> > > static int mem_cgroup_count_children_cb(struct mem_cgroup *mem, void *data)
> > > {
> > > int *val = data;
> > > @@ -1275,34 +1423,70 @@ static void record_last_oom(struct mem_cgroup *mem)
> > > }
> > >
> > > /*
> > > - * Currently used to update mapped file statistics, but the routine can be
> > > - * generalized to update other statistics as well.
> > > + * Generalized routine to update file cache's status for memcg.
> > > + *
> > > + * Before calling this, mapping->tree_lock should be held and preemption is
> > > + * disabled. Then, it's guarnteed that the page is not uncharged while we
> > > + * access page_cgroup. We can make use of that.
> > > */
> > IIUC, mapping->tree_lock is held with irq disabled, so I think "mapping->tree_lock
> > should be held with irq disabled" would be enouth.
> > And, as far as I can see, callers of this function have not ensured this yet in [4/4].
> >
> > how about:
> >
> > void mem_cgroup_update_stat_locked(...)
> > {
> > ...
> > }
> >
> > void mem_cgroup_update_stat_unlocked(mapping, ...)
> > {
> > spin_lock_irqsave(mapping->tree_lock, ...);
> > mem_cgroup_update_stat_locked();
> > spin_unlock_irqrestore(...);
> > }
> >
> Rather than tree_lock, lock_page_cgroup() can be used if tree_lock is not held.
>
> lock_page_cgroup();
> mem_cgroup_update_stat_locked();
> unlock_page_cgroup();
>
> Andrea-san, FILE_MAPPED is updated without treelock, at least. You can't depend
> on migration_lock about FILE_MAPPED.
Right. I'll consider this in the next version of the patch.
Thanks,
-Andrea
WARNING: multiple messages have this Message-ID (diff)
From: Andrea Righi <arighi@develer.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>,
Balbir Singh <balbir@linux.vnet.ibm.com>,
Vivek Goyal <vgoyal@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Trond Myklebust <trond.myklebust@fys.uio.no>,
Suleiman Souhlal <suleiman@google.com>,
Greg Thelen <gthelen@google.com>,
"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
Subject: Re: [PATCH -mmotm 3/4] memcg: dirty pages accounting and limiting infrastructure
Date: Fri, 5 Mar 2010 23:14:56 +0100 [thread overview]
Message-ID: <20100305221456.GB1578@linux> (raw)
In-Reply-To: <20100305105855.9b53176c.kamezawa.hiroyu@jp.fujitsu.com>
On Fri, Mar 05, 2010 at 10:58:55AM +0900, KAMEZAWA Hiroyuki wrote:
> On Fri, 5 Mar 2010 10:12:34 +0900
> Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> wrote:
>
> > On Thu, 4 Mar 2010 11:40:14 +0100, Andrea Righi <arighi@develer.com> wrote:
> > > Infrastructure to account dirty pages per cgroup and add dirty limit
> > > static int mem_cgroup_count_children_cb(struct mem_cgroup *mem, void *data)
> > > {
> > > int *val = data;
> > > @@ -1275,34 +1423,70 @@ static void record_last_oom(struct mem_cgroup *mem)
> > > }
> > >
> > > /*
> > > - * Currently used to update mapped file statistics, but the routine can be
> > > - * generalized to update other statistics as well.
> > > + * Generalized routine to update file cache's status for memcg.
> > > + *
> > > + * Before calling this, mapping->tree_lock should be held and preemption is
> > > + * disabled. Then, it's guarnteed that the page is not uncharged while we
> > > + * access page_cgroup. We can make use of that.
> > > */
> > IIUC, mapping->tree_lock is held with irq disabled, so I think "mapping->tree_lock
> > should be held with irq disabled" would be enouth.
> > And, as far as I can see, callers of this function have not ensured this yet in [4/4].
> >
> > how about:
> >
> > void mem_cgroup_update_stat_locked(...)
> > {
> > ...
> > }
> >
> > void mem_cgroup_update_stat_unlocked(mapping, ...)
> > {
> > spin_lock_irqsave(mapping->tree_lock, ...);
> > mem_cgroup_update_stat_locked();
> > spin_unlock_irqrestore(...);
> > }
> >
> Rather than tree_lock, lock_page_cgroup() can be used if tree_lock is not held.
>
> lock_page_cgroup();
> mem_cgroup_update_stat_locked();
> unlock_page_cgroup();
>
> Andrea-san, FILE_MAPPED is updated without treelock, at least. You can't depend
> on migration_lock about FILE_MAPPED.
Right. I'll consider this in the next version of the patch.
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>
next prev parent reply other threads:[~2010-03-05 22:15 UTC|newest]
Thread overview: 101+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-04 10:40 [PATCH -mmotm 0/4] memcg: per cgroup dirty limit (v4) Andrea Righi
2010-03-04 10:40 ` Andrea Righi
2010-03-04 10:40 ` [PATCH -mmotm 1/4] memcg: dirty memory documentation Andrea Righi
2010-03-04 10:40 ` Andrea Righi
[not found] ` <1267699215-4101-1-git-send-email-arighi-vWjgImWzx8FBDgjK7y7TUQ@public.gmane.org>
2010-03-04 10:40 ` Andrea Righi
2010-03-04 10:40 ` [PATCH -mmotm 2/4] page_cgroup: introduce file cache flags Andrea Righi
2010-03-04 10:40 ` [PATCH -mmotm 3/4] memcg: dirty pages accounting and limiting infrastructure Andrea Righi
2010-03-04 10:40 ` [PATCH -mmotm 4/4] memcg: dirty pages instrumentation Andrea Righi
2010-03-04 17:11 ` [PATCH -mmotm 0/4] memcg: per cgroup dirty limit (v4) Balbir Singh
2010-03-04 10:40 ` [PATCH -mmotm 2/4] page_cgroup: introduce file cache flags Andrea Righi
2010-03-04 10:40 ` Andrea Righi
[not found] ` <1267699215-4101-3-git-send-email-arighi-vWjgImWzx8FBDgjK7y7TUQ@public.gmane.org>
2010-03-05 6:32 ` Balbir Singh
2010-03-05 6:32 ` Balbir Singh
2010-03-05 6:32 ` Balbir Singh
2010-03-05 22:35 ` Andrea Righi
2010-03-05 22:35 ` Andrea Righi
[not found] ` <20100305063249.GH3073-SINUvgVNF2CyUtPGxGje5AC/G2K4zDHf@public.gmane.org>
2010-03-05 22:35 ` Andrea Righi
2010-03-04 10:40 ` [PATCH -mmotm 3/4] memcg: dirty pages accounting and limiting infrastructure Andrea Righi
2010-03-04 10:40 ` Andrea Righi
2010-03-04 11:54 ` Kirill A. Shutemov
2010-03-04 11:54 ` Kirill A. Shutemov
[not found] ` <1267699215-4101-4-git-send-email-arighi-vWjgImWzx8FBDgjK7y7TUQ@public.gmane.org>
2010-03-04 11:54 ` Kirill A. Shutemov
2010-03-05 1:12 ` Daisuke Nishimura
2010-03-05 1:12 ` Daisuke Nishimura
2010-03-05 1:12 ` Daisuke Nishimura
2010-03-05 1:58 ` KAMEZAWA Hiroyuki
2010-03-05 1:58 ` KAMEZAWA Hiroyuki
[not found] ` <20100305105855.9b53176c.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2010-03-05 7:01 ` Balbir Singh
2010-03-05 7:01 ` Balbir Singh
2010-03-05 7:01 ` Balbir Singh
2010-03-05 22:14 ` Andrea Righi
2010-03-05 22:14 ` Andrea Righi [this message]
2010-03-05 22:14 ` Andrea Righi
[not found] ` <20100305101234.909001e8.nishimura-YQH0OdQVrdy45+QrQBaojngSJqDPrsil@public.gmane.org>
2010-03-05 1:58 ` KAMEZAWA Hiroyuki
2010-03-05 22:14 ` Andrea Righi
2010-03-05 22:14 ` Andrea Righi
2010-03-05 22:14 ` Andrea Righi
2010-03-04 10:40 ` [PATCH -mmotm 4/4] memcg: dirty pages instrumentation Andrea Righi
2010-03-04 10:40 ` Andrea Righi
2010-03-04 16:18 ` Vivek Goyal
2010-03-04 16:18 ` Vivek Goyal
2010-03-04 16:28 ` Andrea Righi
2010-03-04 16:28 ` Andrea Righi
[not found] ` <20100304161828.GC18786-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-03-04 16:28 ` Andrea Righi
2010-03-05 6:38 ` Balbir Singh
2010-03-05 6:38 ` Balbir Singh
[not found] ` <20100305063843.GI3073-SINUvgVNF2CyUtPGxGje5AC/G2K4zDHf@public.gmane.org>
2010-03-05 22:55 ` Andrea Righi
2010-03-05 22:55 ` Andrea Righi
2010-03-05 22:55 ` Andrea Righi
[not found] ` <1267699215-4101-5-git-send-email-arighi-vWjgImWzx8FBDgjK7y7TUQ@public.gmane.org>
2010-03-04 16:18 ` Vivek Goyal
2010-03-04 19:41 ` Vivek Goyal
2010-03-04 19:41 ` Vivek Goyal
2010-03-04 19:41 ` Vivek Goyal
[not found] ` <20100304194144.GE18786-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-03-04 21:51 ` Andrea Righi
2010-03-04 21:51 ` Andrea Righi
2010-03-04 21:51 ` Andrea Righi
2010-03-05 6:38 ` Balbir Singh
2010-03-04 17:11 ` [PATCH -mmotm 0/4] memcg: per cgroup dirty limit (v4) Balbir Singh
2010-03-04 17:11 ` Balbir Singh
2010-03-04 21:37 ` Andrea Righi
2010-03-04 21:37 ` Andrea Righi
[not found] ` <20100304171143.GG3073-SINUvgVNF2CyUtPGxGje5AC/G2K4zDHf@public.gmane.org>
2010-03-04 21:37 ` Andrea Righi
-- strict thread matches above, loose matches on Subject: below --
2010-03-07 20:57 [PATCH -mmotm 0/4] memcg: per cgroup dirty limit (v5) Andrea Righi
2010-03-07 20:57 ` [PATCH -mmotm 3/4] memcg: dirty pages accounting and limiting infrastructure Andrea Righi
2010-03-07 20:57 ` Andrea Righi
2010-03-08 1:44 ` Daisuke Nishimura
2010-03-08 1:44 ` Daisuke Nishimura
[not found] ` <20100308104447.c124c1ff.nishimura-YQH0OdQVrdy45+QrQBaojngSJqDPrsil@public.gmane.org>
2010-03-08 1:56 ` KAMEZAWA Hiroyuki
2010-03-08 1:56 ` KAMEZAWA Hiroyuki
2010-03-08 1:56 ` KAMEZAWA Hiroyuki
[not found] ` <20100308105641.e2e714f4.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2010-03-08 2:17 ` Daisuke Nishimura
2010-03-08 2:17 ` Daisuke Nishimura
2010-03-08 2:17 ` Daisuke Nishimura
[not found] ` <20100308111724.3e48aee3.nishimura-YQH0OdQVrdy45+QrQBaojngSJqDPrsil@public.gmane.org>
2010-03-08 2:37 ` KAMEZAWA Hiroyuki
2010-03-08 2:37 ` KAMEZAWA Hiroyuki
2010-03-08 2:37 ` KAMEZAWA Hiroyuki
2010-03-08 8:07 ` Daisuke Nishimura
2010-03-08 8:07 ` Daisuke Nishimura
2010-03-08 8:31 ` KAMEZAWA Hiroyuki
2010-03-08 8:31 ` KAMEZAWA Hiroyuki
2010-03-09 0:12 ` Andrea Righi
2010-03-09 0:12 ` Andrea Righi
2010-03-09 0:19 ` KAMEZAWA Hiroyuki
2010-03-09 0:19 ` KAMEZAWA Hiroyuki
2010-03-09 0:19 ` KAMEZAWA Hiroyuki
2010-03-09 0:18 ` Daisuke Nishimura
2010-03-09 0:18 ` Daisuke Nishimura
[not found] ` <20100309091845.d38b43ff.nishimura-YQH0OdQVrdy45+QrQBaojngSJqDPrsil@public.gmane.org>
2010-03-09 0:20 ` KAMEZAWA Hiroyuki
2010-03-09 0:20 ` KAMEZAWA Hiroyuki
2010-03-09 0:20 ` KAMEZAWA Hiroyuki
[not found] ` <20100309092054.b18a4ff2.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2010-03-09 0:52 ` Daisuke Nishimura
2010-03-09 0:52 ` Daisuke Nishimura
2010-03-09 0:52 ` Daisuke Nishimura
[not found] ` <20100308173100.b5997fd4.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2010-03-09 0:12 ` Andrea Righi
2010-03-09 0:18 ` Daisuke Nishimura
2010-03-09 0:03 ` Andrea Righi
2010-03-09 0:03 ` Andrea Righi
[not found] ` <20100308170711.4d8b02f0.nishimura-YQH0OdQVrdy45+QrQBaojngSJqDPrsil@public.gmane.org>
2010-03-08 8:31 ` KAMEZAWA Hiroyuki
2010-03-09 0:03 ` Andrea Righi
[not found] ` <20100308113711.d7a249da.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2010-03-08 8:07 ` Daisuke Nishimura
[not found] ` <1267995474-9117-4-git-send-email-arighi-vWjgImWzx8FBDgjK7y7TUQ@public.gmane.org>
2010-03-08 1:44 ` Daisuke Nishimura
[not found] ` <1267995474-9117-1-git-send-email-arighi-vWjgImWzx8FBDgjK7y7TUQ@public.gmane.org>
2010-03-07 20:57 ` Andrea Righi
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=20100305221456.GB1578@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 \
--cc=vgoyal@redhat.com \
/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.