From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail172.messagelabs.com (mail172.messagelabs.com [216.82.254.3]) by kanga.kvack.org (Postfix) with ESMTP id 8F7226B00E6 for ; Tue, 5 Jan 2010 13:28:07 -0500 (EST) Date: Tue, 5 Jan 2010 10:25:43 -0800 (PST) From: Linus Torvalds Subject: Re: [RFC][PATCH 6/8] mm: handle_speculative_fault() In-Reply-To: Message-ID: References: <20100104182429.833180340@chello.nl> <20100104182813.753545361@chello.nl> <20100105092559.1de8b613.kamezawa.hiroyu@jp.fujitsu.com> <28c262361001042029w4b95f226lf54a3ed6a4291a3b@mail.gmail.com> <20100105134357.4bfb4951.kamezawa.hiroyu@jp.fujitsu.com> <20100105143046.73938ea2.kamezawa.hiroyu@jp.fujitsu.com> <20100105163939.a3f146fb.kamezawa.hiroyu@jp.fujitsu.com> <87wrzwbh0z.fsf@basil.nowhere.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org To: Christoph Lameter Cc: Andi Kleen , KAMEZAWA Hiroyuki , Minchan Kim , Peter Zijlstra , "Paul E. McKenney" , Peter Zijlstra , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "hugh.dickins" , Nick Piggin , Ingo Molnar List-ID: On Tue, 5 Jan 2010, Christoph Lameter wrote: > > If the critical section protected by the spinlock is small then the > delay will keep the cacheline exclusive until we hit the unlock. This > is the case here as far as I can tell. I hope somebody can time it. Because I think the idle reads on all the (unsuccessful) spinlocks will kill it. Think of it this way: under heavy contention, you'll see a lot of people waiting for the spinlocks and one of them succeeds at writing it, reading the line. So you get an O(n^2) bus traffic access pattern. In contrast, with an xadd, you get O(n) behavior - everybody does _one_ acquire-for- write bus access. Remember: the critical section is small, but since you're contending on the spinlock, that doesn't much _help_. The readers are all hitting the lock (and you can try to solve the O(n*2) issue with back-off, but quite frankly, anybody who does that has basically already lost - I'm personally convinced you should never do lock backoff, and instead look at what you did wrong at a higher level instead). Linus -- 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