Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932485AbZLRSap (ORCPT ); Fri, 18 Dec 2009 13:30:45 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932343AbZLRSao (ORCPT ); Fri, 18 Dec 2009 13:30:44 -0500 Received: from smtp-vbr13.xs4all.nl ([194.109.24.33]:3268 "EHLO smtp-vbr13.xs4all.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932329AbZLRSan (ORCPT ); Fri, 18 Dec 2009 13:30:43 -0500 X-Greylist: delayed 679 seconds by postgrey-1.27 at vger.kernel.org; Fri, 18 Dec 2009 13:30:43 EST Subject: Re: spinlock which can morph into a mutex From: Miquel van Smoorenburg To: Thomas Gleixner Cc: Ingo Molnar , linux-kernel@vger.kernel.org In-Reply-To: References: <20091218143032.GA16595@xs4all.net> Content-Type: text/plain; charset="ANSI_X3.4-1968" Date: Fri, 18 Dec 2009 19:19:07 +0100 Message-ID: <1261160347.30286.6.camel@laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1075 Lines: 35 On Fri, 2009-12-18 at 18:14 +0100, Thomas Gleixner wrote: > On Fri, 18 Dec 2009, Miquel van Smoorenburg wrote: > I think I need a spinlock that can morph into a mutex .. > > Is the writer frequency and the possible contention so high that you > need a spinlock at all ? Possibly - I don't want to degrade the performance of existing code (which uses a spinlock). > Test it :) Good point. > If the mutex is still to heavy weight for you, then you can solve it > without implementing another weird concurrency control: > > wait_event_(un)interruptible(&hash_wq, !hash_update_active); > > hash_update_active = 1; > .... > hash_update_active = 0; > wake_up(&hash_wq); Ah, ofcourse. Thanks for pointing that out! Thanks everybody for your input. I gained quite a bit of insight. Mike. -- 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/