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

From: Ryan Mallon
Date: Tue Mar 05 2013 - 17:29:54 EST


On 05/03/13 05:37, Tejun Heo wrote:
> Introduce struct workqueue_attrs which carries worker attributes -
> currently the nice level and allowed cpumask along with helper
> routines alloc_workqueue_attrs() and free_workqueue_attrs().
>
> Each worker_pool now carries ->attrs describing the attributes of its
> workers. All functions dealing with cpumask and nice level of workers
> are updated to follow worker_pool->attrs instead of determining them
> from other characteristics of the worker_pool, and init_workqueues()
> is updated to set worker_pool->attrs appropriately for all standard
> pools.
>
> Note that create_worker() is updated to always perform set_user_nice()
> and use set_cpus_allowed_ptr() combined with manual assertion of
> PF_THREAD_BOUND instead of kthread_bind(). This simplifies handling
> random attributes without affecting the outcome.
>
> This patch doesn't introduce any behavior changes.
>
> v2: Missing cpumask_var_t definition caused build failure on some
> archs. linux/cpumask.h included.
>
> Signed-off-by: Tejun Heo <tj@xxxxxxxxxx>
> Reported-by: kbuild test robot <fengguang.wu@xxxxxxxxx>

> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -148,6 +148,8 @@ struct worker_pool {
> struct mutex assoc_mutex; /* protect POOL_DISASSOCIATED */
> struct ida worker_ida; /* L: for worker IDs */
>
> + struct workqueue_attrs *attrs; /* I: worker attributes */

If attrs always exists, why not just embed the struct and avoid the
need to alloc/free it?

~Ryan

--
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/