Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754130Ab0AEJhx (ORCPT ); Tue, 5 Jan 2010 04:37:53 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753572Ab0AEJhx (ORCPT ); Tue, 5 Jan 2010 04:37:53 -0500 Received: from casper.infradead.org ([85.118.1.10]:35001 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753526Ab0AEJhw (ORCPT ); Tue, 5 Jan 2010 04:37:52 -0500 Subject: Re: [RFC][PATCH 6/8] mm: handle_speculative_fault() From: Peter Zijlstra To: Linus Torvalds Cc: KAMEZAWA Hiroyuki , "Paul E. McKenney" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "minchan.kim@gmail.com" , cl@linux-foundation.org, "hugh.dickins" , Nick Piggin , Ingo Molnar In-Reply-To: References: <20100104182429.833180340@chello.nl> <20100104182813.753545361@chello.nl> <20100105092559.1de8b613.kamezawa.hiroyu@jp.fujitsu.com> Content-Type: text/plain; charset="UTF-8" Date: Tue, 05 Jan 2010 10:37:09 +0100 Message-ID: <1262684229.2400.37.camel@laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1574 Lines: 48 On Mon, 2010-01-04 at 19:13 -0800, Linus Torvalds wrote: > > Protecting the vma isn't enough. You need to protect the whole FS stack > with rcu. Probably by moving _all_ of "free_vma()" into the RCU path > (which means that the whole file/inode gets de-allocated at that later RCU > point, rather than synchronously). Not just the actual kfree. Right, looking at that I found another interesting challenge, fput() can sleep and I suspect that even with call_srcu() its callbacks have to be atomic. While looking at that code, I found the placement of might_sleep() a tad confusing, I'd expect that to be in fput() since that is the regular entry point (all except AIO, which does crazy things). --- fs/file_table.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/file_table.c b/fs/file_table.c index 69652c5..6070c32 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -196,6 +196,8 @@ EXPORT_SYMBOL(alloc_file); void fput(struct file *file) { + might_sleep(); + if (atomic_long_dec_and_test(&file->f_count)) __fput(file); } @@ -236,8 +238,6 @@ void __fput(struct file *file) struct vfsmount *mnt = file->f_path.mnt; struct inode *inode = dentry->d_inode; - might_sleep(); - fsnotify_close(file); /* * The function eventpoll_release() should be the first called -- 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/