[PATCH] zcache: Use WARN_ON_SMP in ASSERT_SPINLOCK

Dan Magenheimer dan.magenheimer at oracle.com
Wed Mar 21 16:38:57 UTC 2012


> From: Jörg Sommer [mailto:joerg at alea.gnuu.de]
> Sent: Wednesday, March 21, 2012 1:07 AM
> To: Dan Magenheimer
> Cc: Greg Kroah-Hartman; devel at driverdev.osuosl.org; Seth Jennings; Nitin Gupta
> Subject: Re: [PATCH] zcache: Use WARN_ON_SMP in ASSERT_SPINLOCK
> 
> Greg Kroah-Hartman hat am Tue 13. Mar, 09:54 (-0700) geschrieben:
> > On Tue, Mar 13, 2012 at 09:41:35AM -0700, Dan Magenheimer wrote:
> > > > From: Jörg Sommer [mailto:joerg at alea.gnuu.de]
> > > > Sent: Monday, March 12, 2012 2:01 PM
> > > > To: Greg Kroah-Hartman
> > > > Cc: Dan Magenheimer; Seth Jennings; devel at driverdev.osuosl.org
> > > > Subject: Re: [PATCH] zcache: Use WARN_ON_SMP in ASSERT_SPINLOCK
> > > >
> > > > Greg Kroah-Hartman hat am Sun 11. Mar, 19:50 (-0700) geschrieben:
> > > > > On Sun, Mar 11, 2012 at 10:00:54PM +0100, Jörg Sommer wrote:
> > > > > > As the description of WARN_ON_SMP in bug.h says, one can not use
> > > > > > spin_is_locked() in assertions for non‐SMP configurations, because it
> > > > > > always returns the lock is not held. Otherwise a warning is thrown
> > > > > > everytime on a uniprocessor system.
> > > > > > ---
> > > > > >  drivers/staging/zcache/tmem.h |    2 +-
> > > > > >  1 files changed, 1 insertions(+), 1 deletions(-)
> > > > > >
> > > > > > diff --git a/drivers/staging/zcache/tmem.h b/drivers/staging/zcache/tmem.h
> > > > > > index ed147c4..b543694 100644
> > > > > > --- a/drivers/staging/zcache/tmem.h
> > > > > > +++ b/drivers/staging/zcache/tmem.h
> > > > > > @@ -47,7 +47,7 @@
> > > > > >  #define ASSERT_INVERTED_SENTINEL(_x, _y) do { } while (0)
> > > > > >  #endif
> > > > > >
> > > > > > -#define ASSERT_SPINLOCK(_l)	WARN_ON(!spin_is_locked(_l))
> > > > > > +#define ASSERT_SPINLOCK(_l)	WARN_ON_SMP(!spin_is_locked(_l))
> > > > >
> > > > > Why do we even have asserts in this code in the first place?  Shouldn't
> > > > > they all be removed by now?
> > > >
> > > > I don't know, why the asserts are there. But if the asserts get removed,
> > > > the sentinel zones can be removed, too, because noone checks them. This
> > > > would be a big interference. If the code is stable enough, it can be
> > > > cleaned up. But I can't say anything about it. I couldn't use zcache
> > > > until now, because the kernel flooded the log with warnings.
> > > >
> > > > Regards, Jörg.
> > > > --
> > > > Der Klügere gibt so lange nach bis er der Dumme ist.
> > >
> > > Hi Jorg and Greg --
> > >
> > > Jorg, thanks for fixing that!  I admit I never run with SMP
> > > disabled anymore so I'm sorry it interfered with your use.
> >
> > Can I get your ack for this?
> 
> ping

Sorry, I missed that.  I meant to ack it in the "thanks" message.

Acked-by: Dan Magenheimer <dan.magenheimer at oracle.com>



More information about the devel mailing list