Re: [PATCH 2/2] firmware_class: Move request_firmware_nowait() to workqueues

From: Rafael J. Wysocki
Date: Tue Mar 27 2012 - 18:50:44 EST


On Wednesday, March 28, 2012, Tejun Heo wrote:
> On Wed, Mar 28, 2012 at 12:21:27AM +0200, Rafael J. Wysocki wrote:
> > On Wednesday, March 28, 2012, Tejun Heo wrote:
> > > On Tue, Mar 27, 2012 at 02:28:30PM -0700, Stephen Boyd wrote:
> > > > Oddly enough a work_struct was already part of the firmware_work
> > > > structure but nobody was using it. Instead of creating a new
> > > > kthread for each request_firmware_nowait() call just schedule the
> > > > work on the long system workqueue. This should avoid some overhead
> > > > in forking new threads when they're not strictly necessary.
> > > >
> > > > Signed-off-by: Stephen Boyd <sboyd@xxxxxxxxxxxxxx>
> > > > ---
> > > >
> > > > Is it better to use alloc_workqueue() and not put these on the system
> > > > long workqueue?
> > >
> > > No, just use schedule_work() unless there are specific requirements
> > > which can't be fulfilled that way (e.g. it's on memory allocation
> > > path, may consume large amount of cpu cycles, ...)
> >
> > It may wait quite long.
>
> That shouldn't matter. system_long_wq's name is a bit misleading at
> this point. The only reason it's used currently is to avoid cyclic
> dependency involving flush_workqueue(), which calls for clearer
> solution anyway. So, yeap, using system_wq should be fine here.

Good, thanks for the explanation.

Stephen, care to respin?

Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/