Re: [PATCH v2 16/31] workqueue: introduce workqueue_attrs

Tejun Heo
2013-03-05T23:28:36Z

On Wed, Mar 06, 2013 at 10:20:20AM +1100, Ryan Mallon wrote:
> I don't get why you would need to separate init/alloc. Nothing in the
> patch series appears to have optional attrs (e.g. a case where attrs

Because workqueue users would want to use workqueue_attrs to specify
attributes and thanks to cpumask_var_t we need alloc interface anyway
and by just allocating the whole thing dynamically we can allow
workqueue_attrs to grow beyond size which is appropriate to allocate
on stack. Plus, its users are less likely to make mistakes with plain
alloc/free interface than init interface which takes pointer to an
existing object but may fail, which is rather unusual.

Whether the struct itself is dynamic or not just doesn't matter and
it's just easier to have plain alloc/free if there has to be an init
step which may fail.

--
tejun