From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Thu, 3 May 2007 13:58:52 +0100 (BST) From: Hugh Dickins Subject: Re: 2.6.22 -mm merge plans -- vm bugfixes In-Reply-To: <4639D8E8.2090608@yahoo.com.au> Message-ID: References: <20070430162007.ad46e153.akpm@linux-foundation.org> <4636FDD7.9080401@yahoo.com.au> <4638009E.3070408@yahoo.com.au> <46393BA7.6030106@yahoo.com.au> <4639D8E8.2090608@yahoo.com.au> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org Return-Path: To: Nick Piggin Cc: Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrea Arcangeli , Christoph Hellwig List-ID: On Thu, 3 May 2007, Nick Piggin wrote: > >>@@ -568,6 +570,11 @@ __lock_page (diff -p would tell us!) > > > { > > > DEFINE_WAIT_BIT(wait, &page->flags, PG_locked); > > > > > >+ set_bit(PG_waiters, &page->flags); > > >+ if (unlikely(!TestSetPageLocked(page))) { > > > > What happens if another cpu is coming through __lock_page at the > > same time, did its set_bit, now finds PageLocked, and so proceeds > > to the __wait_on_bit_lock? But this cpu now clears PG_waiters, > > so this task's unlock_page won't wake the other? > > You're right, we can't clear the bit here. Doubt it mattered much anyway? Ah yes, that's a good easy answer. In fact, just remove this whole test and block (we already tried TestSetPageLocked outside just a short while ago, so this repeat won't often save anything). > > BTW. I also forgot an smp_mb__after_clear_bit() before the wake_up_page > above... that barrier is in the slow path as well though, so it shouldn't > matter either. I vaguely wondered how such barriers had managed to dissolve away, but cranking my brain up to think about barriers takes far too long. > > >+ clear_bit(PG_waiters, &page->flags); > > >+ return; > > >+ } > > > __wait_on_bit_lock(page_waitqueue(page), &wait, sync_page, > > > TASK_UNINTERRUPTIBLE); > >> } -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org