Lines Matching defs:attrs

90 	UNBOUND_POOL_HASH_ORDER	= 6,		/* hashed by pool->attrs */
176 struct workqueue_attrs *attrs; /* I: worker attributes */
334 /* PL: hash of all unbound pools keyed by pool->attrs */
1870 set_cpus_allowed_ptr(worker->task, pool->attrs->cpumask);
1938 pool->attrs->nice < 0 ? "H" : "");
1947 set_user_nice(worker->task, pool->attrs->nice);
1948 kthread_bind_mask(worker->task, pool->attrs->cpumask);
3354 * @attrs: workqueue_attrs to free
3358 void free_workqueue_attrs(struct workqueue_attrs *attrs)
3360 if (attrs) {
3361 free_cpumask_var(attrs->cpumask);
3362 kfree(attrs);
3376 struct workqueue_attrs *attrs;
3378 attrs = kzalloc(sizeof(*attrs), GFP_KERNEL);
3379 if (!attrs)
3381 if (!alloc_cpumask_var(&attrs->cpumask, GFP_KERNEL))
3384 cpumask_copy(attrs->cpumask, cpu_possible_mask);
3385 return attrs;
3387 free_workqueue_attrs(attrs);
3398 * ->no_numa as it is used for both pool and wq attrs. Instead,
3405 static u32 wqattrs_hash(const struct workqueue_attrs *attrs)
3409 hash = jhash_1word(attrs->nice, hash);
3410 hash = jhash(cpumask_bits(attrs->cpumask),
3430 * Initialize a newly zalloc'd @pool. It also allocates @pool->attrs.
3459 pool->attrs = alloc_workqueue_attrs();
3460 if (!pool->attrs)
3523 free_workqueue_attrs(pool->attrs);
3604 * @attrs: the attributes of the worker_pool to get
3606 * Obtain a worker_pool which has the same attributes as @attrs, bump the
3613 * Return: On success, a worker_pool with the same attributes as @attrs.
3616 static struct worker_pool *get_unbound_pool(const struct workqueue_attrs *attrs)
3618 u32 hash = wqattrs_hash(attrs);
3627 if (wqattrs_equal(pool->attrs, attrs)) {
3636 if (cpumask_subset(attrs->cpumask,
3650 copy_workqueue_attrs(pool->attrs, attrs);
3657 pool->attrs->no_numa = false;
3820 const struct workqueue_attrs *attrs)
3827 pool = get_unbound_pool(attrs);
3843 * @attrs: the wq_attrs of the default pwq of the target workqueue
3848 * Calculate the cpumask a workqueue with @attrs should use on @node. If
3852 * If NUMA affinity is not enabled, @attrs->cpumask is always used. If
3853 * enabled and @node has online CPUs requested by @attrs, the returned
3855 * @attrs->cpumask.
3860 * Return: %true if the resulting @cpumask is different from @attrs->cpumask,
3863 static bool wq_calc_node_cpumask(const struct workqueue_attrs *attrs, int node,
3866 if (!wq_numa_enabled || attrs->no_numa)
3869 /* does @node have any online CPUs @attrs wants? */
3870 cpumask_and(cpumask, cpumask_of_node(node), attrs->cpumask);
3877 /* yeap, return possible CPUs in @node that @attrs wants */
3878 cpumask_and(cpumask, attrs->cpumask, wq_numa_possible_cpumask[node]);
3886 return !cpumask_equal(cpumask, attrs->cpumask);
3889 cpumask_copy(cpumask, attrs->cpumask);
3911 /* context to store the prepared attrs & pwqs before applying */
3914 struct workqueue_attrs *attrs; /* attrs to apply */
3930 free_workqueue_attrs(ctx->attrs);
3936 /* allocate the attrs and pwqs for later installation */
3939 const struct workqueue_attrs *attrs)
3955 * Calculate the attrs of the default pwq.
3959 copy_workqueue_attrs(new_attrs, attrs);
3973 * the default pwq covering whole @attrs->cpumask. Always create
3991 /* save the user configured attrs and sanitize it. */
3992 copy_workqueue_attrs(new_attrs, attrs);
3994 ctx->attrs = new_attrs;
4007 /* set attrs and install prepared pwqs, @ctx points to old pwqs on return */
4015 copy_workqueue_attrs(ctx->wq->unbound_attrs, ctx->attrs);
4043 const struct workqueue_attrs *attrs)
4059 ctx = apply_wqattrs_prepare(wq, attrs);
4073 * @attrs: the workqueue_attrs to apply, allocated with alloc_workqueue_attrs()
4075 * Apply @attrs to an unbound workqueue @wq. Unless disabled, on NUMA
4077 * possibles CPUs in @attrs->cpumask so that work items are affine to the
4089 const struct workqueue_attrs *attrs)
4096 ret = apply_workqueue_attrs_locked(wq, attrs);
4156 if (wq_calc_node_cpumask(wq->dfl_pwq->pool->attrs, node, cpu_off, cpumask)) {
4157 if (cpumask_equal(cpumask, pwq->pool->attrs->cpumask))
4690 pr_cont(" cpus=%*pbl", nr_cpumask_bits, pool->attrs->cpumask);
4693 pr_cont(" flags=0x%x nice=%d", pool->flags, pool->attrs->nice);
4996 pool->attrs->cpumask) < 0);
5058 if (!cpumask_test_cpu(cpu, pool->attrs->cpumask))
5061 cpumask_and(&cpumask, pool->attrs->cpumask, cpu_online_mask);
5348 * -ENOMEM - Failed to allocate memory for attrs or pwqs.
5496 struct workqueue_attrs *attrs;
5500 attrs = alloc_workqueue_attrs();
5501 if (!attrs)
5504 copy_workqueue_attrs(attrs, wq->unbound_attrs);
5505 return attrs;
5512 struct workqueue_attrs *attrs;
5517 attrs = wq_sysfs_prep_attrs(wq);
5518 if (!attrs)
5521 if (sscanf(buf, "%d", &attrs->nice) == 1 &&
5522 attrs->nice >= MIN_NICE && attrs->nice <= MAX_NICE)
5523 ret = apply_workqueue_attrs_locked(wq, attrs);
5529 free_workqueue_attrs(attrs);
5551 struct workqueue_attrs *attrs;
5556 attrs = wq_sysfs_prep_attrs(wq);
5557 if (!attrs)
5560 ret = cpumask_parse(buf, attrs->cpumask);
5562 ret = apply_workqueue_attrs_locked(wq, attrs);
5566 free_workqueue_attrs(attrs);
5588 struct workqueue_attrs *attrs;
5593 attrs = wq_sysfs_prep_attrs(wq);
5594 if (!attrs)
5599 attrs->no_numa = !v;
5600 ret = apply_workqueue_attrs_locked(wq, attrs);
5605 free_workqueue_attrs(attrs);
5991 cpumask_copy(pool->attrs->cpumask, cpumask_of(cpu));
5992 pool->attrs->nice = std_nice[i++];
6002 /* create default unbound and ordered wq attrs */
6004 struct workqueue_attrs *attrs;
6006 BUG_ON(!(attrs = alloc_workqueue_attrs()));
6007 attrs->nice = std_nice[i];
6008 unbound_std_wq_attrs[i] = attrs;
6015 BUG_ON(!(attrs = alloc_workqueue_attrs()));
6016 attrs->nice = std_nice[i];
6017 attrs->no_numa = true;
6018 ordered_wq_attrs[i] = attrs;