[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20100909182649.C94F.A69D9226@jp.fujitsu.com>
Date: Fri, 10 Sep 2010 19:25:43 +0900 (JST)
From: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
To: Mel Gorman <mel@....ul.ie>
Cc: kosaki.motohiro@...fujitsu.com,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
linux-mm@...ck.org, linux-fsdevel@...r.kernel.org,
Linux Kernel List <linux-kernel@...r.kernel.org>,
Rik van Riel <riel@...hat.com>,
Johannes Weiner <hannes@...xchg.org>,
Minchan Kim <minchan.kim@...il.com>,
Wu Fengguang <fengguang.wu@...el.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Dave Chinner <david@...morbit.com>,
Chris Mason <chris.mason@...cle.com>,
Christoph Hellwig <hch@....de>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH 05/10] vmscan: Synchrounous lumpy reclaim use lock_page() instead trylock_page()
> On Thu, Sep 09, 2010 at 01:13:22PM +0900, KOSAKI Motohiro wrote:
> > > On Thu, 9 Sep 2010 12:04:48 +0900
> > > KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com> wrote:
> > >
> > > > On Mon, 6 Sep 2010 11:47:28 +0100
> > > > Mel Gorman <mel@....ul.ie> wrote:
> > > >
> > > > > From: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
> > > > >
> > > > > With synchrounous lumpy reclaim, there is no reason to give up to reclaim
> > > > > pages even if page is locked. This patch uses lock_page() instead of
> > > > > trylock_page() in this case.
> > > > >
> > > > > Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
> > > > > Signed-off-by: Mel Gorman <mel@....ul.ie>
> > > >
> > > > Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
> > > >
> > > Ah......but can't this change cause dead lock ??
> >
> > Yes, this patch is purely crappy. please drop. I guess I was poisoned
> > by poisonous mushroom of Mario Bros.
> >
>
> Lets be clear on what the exact dead lock conditions are. The ones I had
> thought about when I felt this patch was ok were;
>
> o We are not holding the LRU lock (or any lock, we just called cond_resched())
> o We do not have another page locked because we cannot lock multiple pages
> o Kswapd will never be in LUMPY_MODE_SYNC so it is not getting blocked
> o lock_page() itself is not allocating anything that we could recurse on
True, all.
>
> One potential dead lock would be if the direct reclaimer held a page
> lock and ended up here but is that situation even allowed?
example,
__do_fault()
{
(snip)
if (unlikely(!(ret & VM_FAULT_LOCKED)))
lock_page(vmf.page);
else
VM_BUG_ON(!PageLocked(vmf.page));
/*
* Should we do an early C-O-W break?
*/
page = vmf.page;
if (flags & FAULT_FLAG_WRITE) {
if (!(vma->vm_flags & VM_SHARED)) {
anon = 1;
if (unlikely(anon_vma_prepare(vma))) {
ret = VM_FAULT_OOM;
goto out;
}
page = alloc_page_vma(GFP_HIGHUSER_MOVABLE,
vma, address);
Afaik, detailed rule is,
o kswapd can call lock_page() because they never take page lock outside vmscan
o if try_lock() is successed, we can call lock_page_nosync() against its page after unlock.
because the task have gurantee of no lock taken.
o otherwise, direct reclaimer can't call lock_page(). the task may have a lock already.
I think.
> I did not
> think of an obvious example of when this would happen. Similarly,
> deadlock situations with mmap_sem shouldn't happen unless multiple page
> locks are being taken.
>
> (prepares to feel foolish)
>
> What did I miss?
--
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