Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756471AbYFZJR6 (ORCPT ); Thu, 26 Jun 2008 05:17:58 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754109AbYFZJRt (ORCPT ); Thu, 26 Jun 2008 05:17:49 -0400 Received: from styx.suse.cz ([82.119.242.94]:49491 "EHLO mail.suse.cz" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753846AbYFZJRs (ORCPT ); Thu, 26 Jun 2008 05:17:48 -0400 Subject: Re: Spinlocks: Factor our GENERIC_LOCKBREAK in order to avoid spin with irqs disable From: Petr Tesarik To: Jeremy Fitzhardinge Cc: Peter Zijlstra , Christoph Lameter , Ingo Molnar , linux-kernel@vger.kernel.org, Nick Piggin In-Reply-To: <48630420.1090102@goop.org> References: <20080507073017.GJ32195@elte.hu> <1214241561.19392.21.camel@elijah.suse.cz> <1214253593.11254.30.camel@twins> <1214254730.11254.34.camel@twins> <48630420.1090102@goop.org> Content-Type: text/plain Organization: SUSE LINUX Date: Thu, 26 Jun 2008 11:17:47 +0200 Message-Id: <1214471867.17319.8.camel@elijah.suse.cz> Mime-Version: 1.0 X-Mailer: Evolution 2.6.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1465 Lines: 32 On Wed, 2008-06-25 at 19:51 -0700, Jeremy Fitzhardinge wrote: > [...] > I'm experimenting with adding pvops hook to allow you to put in new > spinlock implementations on the fly. If nothing else, it will be useful > for experimenting with different algorithms. But it definitely seems > like the old unfair lock algorithm played much better with a virtual > environment, because the next cpu to get the lock is the next one the > scheduler gives time, rather than dictating an order - and the scheduler > should mitigate the unfairness that ticket locks were designed to solve. We really should paravirtualize spin locks, because there's always something better to do than just burn time spinning. But in a non-virtualized environment, tickets (or a similar scheme) should be preserved. We should probably re-think the whole locking scheme, because spinlocks were designed to be held for a short period of time. This was a fair assumption when they were introduced, but obviously it is now false in many cases (such as virtualization). Ticket-based spinlocks have actually already changed the original design, so why not implement a generic "lock scheduler" on top of spinlock_t and rwlock_t? Petr Tesarik -- 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/