netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: "Tantilov, Emil S" <emil.s.tantilov@intel.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"Kirsher, Jeffrey T" <jeffrey.t.kirsher@intel.com>,
	netdev <netdev@vger.kernel.org>,
	David Miller <davem@davemloft.net>,
	"Waskiewicz Jr, Peter P" <peter.p.waskiewicz.jr@intel.com>,
	"Duyck, Alexander H" <alexander.h.duyck@intel.com>,
	Ingo Molnar <mingo@elte.hu>, Eric Dumazet <dada1@cosmosbay.com>
Subject: RE: unsafe locks seen with netperf on net-2.6.29 tree
Date: Sat, 27 Dec 2008 21:38:28 +0100	[thread overview]
Message-ID: <1230410308.9487.295.camel@twins> (raw)
In-Reply-To: <EA929A9653AAE14F841771FB1DE5A1365F56B6648A@rrsmsx501.amr.corp.intel.com>

On Sat, 2008-12-27 at 12:38 -0700, Tantilov, Emil S wrote:
> Peter Zijlstra wrote:

> > index 9007ccd..a074d77 100644
> > --- a/include/linux/percpu_counter.h
> > +++ b/include/linux/percpu_counter.h
> > @@ -30,8 +30,16 @@ struct percpu_counter {
> >  #define FBC_BATCH    (NR_CPUS*4)
> >  #endif
> >
> > -int percpu_counter_init(struct percpu_counter *fbc, s64 amount);
> > -int percpu_counter_init_irq(struct percpu_counter *fbc, s64 amount);
> > +int __percpu_counter_init(struct percpu_counter *fbc, s64 amount,
> > +                       struct lock_class_key *key);
> > +
> > +#define percpu_counter_init(fbc, value)                                      \
> > +     do {                                                            \
> > +             static struct lock_class_key __key;                     \
> > +                                                                     \
> > +             __percpu_counter_init(fbc, value, &__key);              \
> > +     } while (0)
> > +
> >  void percpu_counter_destroy(struct percpu_counter *fbc);
> >  void percpu_counter_set(struct percpu_counter *fbc, s64 amount);
> >  void __percpu_counter_add(struct percpu_counter *fbc, s64 amount,

> This patch fails to compile:
> 
> mm/backing-dev.c: In function 'bdi_init':
> mm/backing-dev.c:226: error: expected expression bedore 'do'

Ah indeed, stupid me...

Please try something like this instead of the above hunk:

@@ -30,8 +30,16 @@ struct percpu_counter {
 #define FBC_BATCH      (NR_CPUS*4)
 #endif

-int percpu_counter_init(struct percpu_counter *fbc, s64 amount);
-int percpu_counter_init_irq(struct percpu_counter *fbc, s64 amount);
+int __percpu_counter_init(struct percpu_counter *fbc, s64 amount,
+                         struct lock_class_key *key);
+
+#define percpu_counter_init(fbc, value)                                        \
+       ({                                                              \
+               static struct lock_class_key __key;                     \
+                                                                       \
+               __percpu_counter_init(fbc, value, &__key);              \
+       })
+
 void percpu_counter_destroy(struct percpu_counter *fbc);
 void percpu_counter_set(struct percpu_counter *fbc, s64 amount);
 void __percpu_counter_add(struct percpu_counter *fbc, s64 amount, s32 batch)


  reply	other threads:[~2008-12-27 20:38 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-25 10:25 unsafe locks seen with netperf on net-2.6.29 tree Jeff Kirsher
2008-12-25 11:26 ` Herbert Xu
2008-12-26 14:08   ` Peter Zijlstra
2008-12-27 19:38     ` Tantilov, Emil S
2008-12-27 20:38       ` Peter Zijlstra [this message]
2008-12-28  0:54         ` Tantilov, Emil S
2008-12-29 10:02           ` Peter Zijlstra
2008-12-29 10:07             ` Herbert Xu
2008-12-29 10:16               ` Peter Zijlstra
2008-12-29 10:22                 ` Herbert Xu
2008-12-29 10:31             ` Herbert Xu
2008-12-29 10:37               ` Herbert Xu
2008-12-29 11:28                 ` Ingo Molnar
2008-12-29 11:31                   ` Ingo Molnar
2008-12-29 11:49                   ` Herbert Xu
2008-12-29 11:58                     ` Ingo Molnar
2008-12-29 12:01                       ` Herbert Xu
2008-12-29 12:16                         ` Ingo Molnar
2008-12-29 12:38                           ` Ingo Molnar
2008-12-29 12:44                             ` [patch] locking, percpu counters: introduce separate lock classes Ingo Molnar
2008-12-29 14:14                               ` Ingo Molnar
2008-12-30  3:58                                 ` Herbert Xu
2008-12-30  6:05                                   ` Ingo Molnar
2008-12-30  6:39                                     ` David Miller
2008-12-30  6:56                                       ` Ingo Molnar
2008-12-30  7:04                                         ` David Miller
2008-12-30  7:21                                           ` Ingo Molnar
2008-12-29 12:49                             ` unsafe locks seen with netperf on net-2.6.29 tree Herbert Xu
2008-12-29 12:55                               ` Ingo Molnar
2008-12-29  9:57   ` Ingo Molnar

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=1230410308.9487.295.camel@twins \
    --to=a.p.zijlstra@chello.nl \
    --cc=alexander.h.duyck@intel.com \
    --cc=dada1@cosmosbay.com \
    --cc=davem@davemloft.net \
    --cc=emil.s.tantilov@intel.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=mingo@elte.hu \
    --cc=netdev@vger.kernel.org \
    --cc=peter.p.waskiewicz.jr@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).