From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail137.messagelabs.com (mail137.messagelabs.com [216.82.249.19]) by kanga.kvack.org (Postfix) with ESMTP id BA0E36B007E for ; Fri, 5 Mar 2010 02:01:47 -0500 (EST) Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by e28smtp08.in.ibm.com (8.14.3/8.13.1) with ESMTP id o256HIQ5012248 for ; Fri, 5 Mar 2010 11:47:18 +0530 Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o2571fXm2928678 for ; Fri, 5 Mar 2010 12:31:41 +0530 Received: from d28av04.in.ibm.com (loopback [127.0.0.1]) by d28av04.in.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id o2571eqb009014 for ; Fri, 5 Mar 2010 18:01:41 +1100 Date: Fri, 5 Mar 2010 12:31:33 +0530 From: Balbir Singh Subject: Re: [PATCH -mmotm 3/4] memcg: dirty pages accounting and limiting infrastructure Message-ID: <20100305070133.GJ3073@balbir.in.ibm.com> Reply-To: balbir@linux.vnet.ibm.com References: <1267699215-4101-1-git-send-email-arighi@develer.com> <1267699215-4101-4-git-send-email-arighi@develer.com> <20100305101234.909001e8.nishimura@mxp.nes.nec.co.jp> <20100305105855.9b53176c.kamezawa.hiroyu@jp.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20100305105855.9b53176c.kamezawa.hiroyu@jp.fujitsu.com> Sender: owner-linux-mm@kvack.org To: KAMEZAWA Hiroyuki Cc: Daisuke Nishimura , Andrea Righi , Vivek Goyal , Peter Zijlstra , Trond Myklebust , Suleiman Souhlal , Greg Thelen , "Kirill A. Shutemov" , Andrew Morton , containers@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org List-ID: * KAMEZAWA Hiroyuki [2010-03-05 10:58:55]: > On Fri, 5 Mar 2010 10:12:34 +0900 > Daisuke Nishimura wrote: > > > On Thu, 4 Mar 2010 11:40:14 +0100, Andrea Righi 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. > FILE_MAPPED is updated under pte lock in the rmap context and page_cgroup lock within update_file_mapped. -- Three Cheers, Balbir -- 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: email@kvack.org