From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932713Ab2CAVWS (ORCPT ); Thu, 1 Mar 2012 16:22:18 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:50582 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757888Ab2CAVWR (ORCPT ); Thu, 1 Mar 2012 16:22:17 -0500 Date: Thu, 1 Mar 2012 13:22:15 -0800 From: Andrew Morton To: Jan Kara Cc: Fengguang Wu , Greg Thelen , Ying Han , "hannes@cmpxchg.org" , KAMEZAWA Hiroyuki , Rik van Riel , Mel Gorman , Minchan Kim , Linux Memory Management List , LKML Subject: Re: [PATCH 5/9] writeback: introduce the pageout work Message-Id: <20120301132215.71246044.akpm@linux-foundation.org> In-Reply-To: <20120301211551.GD13104@quack.suse.cz> References: <20120228140022.614718843@intel.com> <20120228144747.198713792@intel.com> <20120228160403.9c9fa4dc.akpm@linux-foundation.org> <20120301110404.GC4385@quack.suse.cz> <20120301114201.d1dcacad.akpm@linux-foundation.org> <20120301211551.GD13104@quack.suse.cz> X-Mailer: Sylpheed 3.0.2 (GTK+ 2.20.1; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 1 Mar 2012 22:15:51 +0100 Jan Kara wrote: > On Thu 01-03-12 11:42:01, Andrew Morton wrote: > > On Thu, 1 Mar 2012 12:04:04 +0100 > > Jan Kara wrote: > > > > > > iirc, the way I "grabbed" the page was to actually lock it, with > > > > [try_]_lock_page(). And unlock it again way over within the writeback > > > > thread. I forget why I did it this way, rather than get_page() or > > > > whatever. Locking the page is a good way of preventing anyone else > > > > from futzing with it. It also pins the inode, which perhaps meant that > > > > with careful management, I could avoid the igrab()/iput() horrors > > > > discussed above. > > > > > > I think using get_page() might be a good way to go. > > > > get_page() doesn't pin the inode - truncate() will still detach it > > from the address_space(). > Yes, I know. And exactly because of that I'd like to use it. Flusher > thread would lock the page from the work item, check whether it is still > attached to the inode and if yes, it will proceed. Otherwise it will just > discard the work item because we know the page has already been written out > by someone else or truncated. That would work OK. The vmscanning process won't know that its writeback effort failed, but it's hard to see how that could cause a problem.