lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 14 Sep 2010 19:14:44 +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()

> > 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);
> > 
> 
> Correct, this is a problem. I already had dropped the patch but thanks for
> pointing out a deadlock because I was missing this case. Nothing stops the
> page being faulted being sent to shrink_page_list() when alloc_page_vma()
> is called. The deadlock might be hard to hit, but it's there.

Yup, unfortunatelly.



> > Afaik, detailed rule is,
> > 
> > o kswapd can call lock_page() because they never take page lock outside vmscan
> 
> lock_page_nosync as you point out in your next mail. While it can call
> it, kswapd shouldn't because normally it avoids stalls but it would not
> deadlock as a result of calling it.

Agreed.


> > 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 the safer bet is simply to say "direct reclaimers should not
> call lock_page() because the fault path could be holding a lock on that
> page already".

Yup, agreed.



--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ