All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel van Smoorenburg <miquels@cistron.nl>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>, linux-kernel@vger.kernel.org
Subject: Re: spinlock which can morph into a mutex
Date: Fri, 18 Dec 2009 19:19:07 +0100	[thread overview]
Message-ID: <1261160347.30286.6.camel@laptop> (raw)
In-Reply-To: <alpine.LFD.2.00.0912181804360.2755@localhost.localdomain>

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.


      reply	other threads:[~2009-12-18 18:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-18 14:30 spinlock which can morph into a mutex Miquel van Smoorenburg
2009-12-18 15:26 ` Andi Kleen
2009-12-18 15:43 ` Peter Zijlstra
2009-12-18 17:14 ` Thomas Gleixner
2009-12-18 18:19   ` Miquel van Smoorenburg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1261160347.30286.6.camel@laptop \
    --to=miquels@cistron.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.