[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20120301114634.957da8d2.akpm@linux-foundation.org>
Date: Thu, 1 Mar 2012 11:46:34 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Fengguang Wu <fengguang.wu@...el.com>
Cc: Jan Kara <jack@...e.cz>, Greg Thelen <gthelen@...gle.com>,
Ying Han <yinghan@...gle.com>,
"hannes@...xchg.org" <hannes@...xchg.org>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
Rik van Riel <riel@...hat.com>, Mel Gorman <mgorman@...e.de>,
Minchan Kim <minchan.kim@...il.com>,
Linux Memory Management List <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 5/9] writeback: introduce the pageout work
On Thu, 1 Mar 2012 19:41:51 +0800
Fengguang Wu <fengguang.wu@...el.com> wrote:
> > I think using get_page() might be a good way to go. Naive implementation:
> > If we need to write a page from kswapd, we do get_page(), attach page to
> > wb_writeback_work and push it to flusher thread to deal with it.
> > Flusher thread sees the work, takes a page lock, verifies the page is still
> > attached to some inode & dirty (it could have been truncated / cleaned by
> > someone else) and if yes, it submits page for IO (possibly with some
> > writearound). This scheme won't have problems with iput() and won't have
> > problems with umount. Also we guarantee some progress - either flusher
> > thread does it, or some else must have done the work before flusher thread
> > got to it.
>
> I like this idea.
>
> get_page() looks the perfect solution to verify if the struct inode
> pointer (w/o igrab) is still live and valid.
>
> [...upon rethinking...] Oh but still we need to lock some page to pin
> the inode during the writeout. Then there is the dilemma: if the page
> is locked, we effectively keep it from being written out...
No, all you need to do is to structure the code so that after the page
gets unlocked, the kernel thread does not touch the address_space. So
the processing within the kthread is along the lines of
writearound(locked_page)
{
write some pages preceding locked_page; /* touches address_space */
write locked_page;
write pages following locked_page; /* touches address_space */
unlock_page(locked_page);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists