Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261230AbVBWQ0c (ORCPT ); Wed, 23 Feb 2005 11:26:32 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261445AbVBWQ0b (ORCPT ); Wed, 23 Feb 2005 11:26:31 -0500 Received: from e3.ny.us.ibm.com ([32.97.182.143]:28141 "EHLO e3.ny.us.ibm.com") by vger.kernel.org with ESMTP id S261230AbVBWQ0a (ORCPT ); Wed, 23 Feb 2005 11:26:30 -0500 Date: Wed, 23 Feb 2005 10:22:26 -0600 To: David Howells Cc: Linus Torvalds , Jamie Lokier , Andrew Morton , linux-kernel@vger.kernel.org, rusty@rustcorp.com.au Subject: Re: [PATCH/RFC] Futex mmap_sem deadlock Message-ID: <20050223162225.GB10256@austin.ibm.com> References: <20050222190646.GA7079@austin.ibm.com> <20050222115503.729cd17b.akpm@osdl.org> <20050222210752.GG22555@mail.shareable.org> <5316.1109158748@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5316.1109158748@redhat.com> User-Agent: Mutt/1.5.6+20040523i From: olof@austin.ibm.com (Olof Johansson) Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 910 Lines: 24 On Wed, Feb 23, 2005 at 11:39:08AM +0000, David Howells wrote: > Alternately, you could just have do_page_fault() do: > > while (!down_read_trylock(¤t->mm->mmap_sem)) > continue; > > However, note that this can suffer from starvation due to a never ending flow > of mixed write-locks and read-locks on other CPUs. Unlikely, true, but not > impossible. How can this help? The semaphore is held for reading by the thread that faulted in futex_wait() -> get_user(), so no writers will be let through. Until the writer has been let through, the down_read_trylock will never succeed either. No forward progress can be made even with the above loop. -Olof - 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/