lkml.org 
[lkml]   [2007]   [Jul]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 6/8] i386: bitops: Don't mark memory as clobbered unnecessarily
From
Date
On Wed, 2007-07-25 at 07:37 +1000, Benjamin Herrenschmidt wrote:
> On Tue, 2007-07-24 at 11:13 -0700, Linus Torvalds wrote:
> >
> > IOW, if you do a spinlock with the bitops, the locking side should be
> > able
> > to use a "test_and_set_bit()" on its own, but the unlocking side
> > should be
> >
> > smp_mb__before_clear_bit();
> > clear_bit();
> >
> > because the ones that don't return a value also don't imply a memory
> > barrier.
>
> Yup. But I much prefer Nick's clear_bit_unlock() :-)
>
> Ben

If you want to use bitops as spinlocks you should rather be using
<linux/bit_spinlock.h>. That also does the right thing w.r.t.
pre-emption and sparse locking annotations.

Trond

-
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/

\
 
 \ /
  Last update: 2007-07-24 23:57    [W:0.121 / U:1.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site