[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070704122505.GB21813@elte.hu>
Date: Wed, 4 Jul 2007 14:25:05 +0200
From: Ingo Molnar <mingo@...e.hu>
To: Johannes Berg <johannes@...solutions.net>
Cc: Oleg Nesterov <oleg@...sign.ru>, Ingo Molnar <mingo@...hat.com>,
Arjan van de Ven <arjan@...ux.intel.com>,
Linux Kernel list <linux-kernel@...r.kernel.org>,
linux-wireless <linux-wireless@...r.kernel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Thomas Sattler <tsattler@....de>
Subject: Re: [RFC/PATCH] debug workqueue deadlocks with lockdep
* Johannes Berg <johannes@...solutions.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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists