lkml.org 
[lkml]   [2009]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: spinlock which can morph into a mutex
From
Date
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.



\
 
 \ /
  Last update: 2009-12-18 19:33    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site