Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758561AbYLEN10 (ORCPT ); Fri, 5 Dec 2008 08:27:26 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752030AbYLEN1S (ORCPT ); Fri, 5 Dec 2008 08:27:18 -0500 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:48694 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751543AbYLEN1R (ORCPT ); Fri, 5 Dec 2008 08:27:17 -0500 Message-ID: <57801.10.75.179.61.1228483630.squirrel@webmail-b.css.fujitsu.com> In-Reply-To: <20081205212450.574f498c.nishimura@mxp.nes.nec.co.jp> References: <20081205212208.31d904e0.nishimura@mxp.nes.nec.co.jp> <20081205212450.574f498c.nishimura@mxp.nes.nec.co.jp> Date: Fri, 5 Dec 2008 22:27:10 +0900 (JST) Subject: Re: [RFC][PATCH -mmotm 3/4] memcg: avoid dead lock caused by racebetween oom and cpuset_attach From: "KAMEZAWA Hiroyuki" To: "Daisuke Nishimura" Cc: "LKML" , "linux-mm" , "Balbir Singh" , "KAMEZAWA Hiroyuki" , "Pavel Emelyanov" , "Li Zefan" , "Paul Menage" , nishimura@mxp.nes.nec.co.jp User-Agent: SquirrelMail/1.4.3a X-Mailer: SquirrelMail/1.4.3a MIME-Version: 1.0 Content-Type: text/plain;charset=us-ascii Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1212 Lines: 34 Daisuke Nishimura said: > mpol_rebind_mm(), which can be called from cpuset_attach(), does > down_write(mm->mmap_sem). > This means down_write(mm->mmap_sem) can be called under cgroup_mutex. > > OTOH, page fault path does down_read(mm->mmap_sem) and calls > mem_cgroup_try_charge_xxx(), > which may eventually calls mem_cgroup_out_of_memory(). And > mem_cgroup_out_of_memory() > calls cgroup_lock(). > This means cgroup_lock() can be called under down_read(mm->mmap_sem). > good catch. > If those two paths race, dead lock can happen. > > This patch avoid this dead lock by: > - remove cgroup_lock() from mem_cgroup_out_of_memory(). agree to this. > - define new mutex (memcg_tasklist) and serialize mem_cgroup_move_task() > (->attach handler of memory cgroup) and mem_cgroup_out_of_memory. > Hmm...seems temporal fix (and adding new global lock...) But ok, we need fix. revist this later. Reviewed-by: KAMEZAWA Hiroyuki -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/