The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: Oleg Nesterov <oleg@tv-sign.ru>, Ingo Molnar <mingo@redhat.com>,
	Arjan van de Ven <arjan@linux.intel.com>,
	Linux Kernel list <linux-kernel@vger.kernel.org>,
	linux-wireless <linux-wireless@vger.kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Thomas Sattler <tsattler@gmx.de>
Subject: Re: [RFC/PATCH] debug workqueue deadlocks with lockdep
Date: Wed, 4 Jul 2007 14:25:05 +0200	[thread overview]
Message-ID: <20070704122505.GB21813@elte.hu> (raw)
In-Reply-To: <1183549772.3812.10.camel@johannes.berg>


* Johannes Berg <johannes@sipsolutions.net> wrote:

> > > +#define create_workqueue(name) \
> > > +({								\
> > > +	static struct lock_class_key __key;			\
> > > +	struct workqueue_struct *__wq;				\
> > > +								\
> > > +	__wq = __create_workqueue((name), 0, 0, &__key);	\
> > > +	__wq;							\
> > > +})
> > 
> > Why do we need __wq ?
> 
> No particular reason I think, I copied some other code doing it that 
> way.

yep, should be fine doing this:

 #define create_workqueue(name)				\
 ({							\
	static struct lock_class_key __key;		\
							\
	__create_workqueue((name), 0, 0, &__key);	\
 })

(and the return value of __create_workqueue() will be the 'return value' 
of the macro as well.)

> > 	+ extern struct workqueue_struct *__create_workqueue_key(..., key);
> > 	+ #define __create_workqueue(...)	\
> > 	+	static struct lock_class_key __key;	\
> > 	+	__create_workqueue_key(..., key);	\
> > 
> > but this is a matter of taste.

the above macro should at minimum be encapsulated with
do { ... } while (0) so that __create_workqueue() is a single C 
statement.

	Ingo

  parent reply	other threads:[~2007-07-04 12:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-27 18:40 [RFC/PATCH] debug workqueue deadlocks with lockdep Johannes Berg
2007-06-28 16:33 ` Johannes Berg
2007-06-28 17:33   ` Johannes Berg
2007-06-30  8:05     ` Ingo Molnar
2007-06-30 11:46       ` Oleg Nesterov
2007-07-02  8:37         ` Johannes Berg
2007-07-02 13:03         ` Johannes Berg
2007-07-03 17:31           ` Oleg Nesterov
2007-07-03 19:42             ` Ingo Molnar
2007-07-04 11:49             ` Johannes Berg
2007-07-04 12:21               ` Ingo Molnar
2007-07-04 13:59                 ` Johannes Berg
2007-07-04 12:25               ` Ingo Molnar [this message]
2007-07-04 12:52               ` Oleg Nesterov
2007-07-04 13:57                 ` Johannes Berg
2007-07-05  8:43                 ` 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=20070704122505.GB21813@elte.hu \
    --to=mingo@elte.hu \
    --cc=a.p.zijlstra@chello.nl \
    --cc=arjan@linux.intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=oleg@tv-sign.ru \
    --cc=tsattler@gmx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox