mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-01 12:04:08 +00:00
Merge branch 'for-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
Pull workqueue update from Tejun Heo: "This pull request contains one patch to make an unbound worker pool allocated from the NUMA node containing it if such node exists. As unbound worker pools are node-affine by default, this makes most pools allocated on the right node" * 'for-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq: workqueue: Allocate the unbound pool using local node memory
This commit is contained in:
commit
e25ac7ddaa
1 changed files with 14 additions and 12 deletions
|
@ -3199,6 +3199,7 @@ static struct worker_pool *get_unbound_pool(const struct workqueue_attrs *attrs)
|
||||||
u32 hash = wqattrs_hash(attrs);
|
u32 hash = wqattrs_hash(attrs);
|
||||||
struct worker_pool *pool;
|
struct worker_pool *pool;
|
||||||
int node;
|
int node;
|
||||||
|
int target_node = NUMA_NO_NODE;
|
||||||
|
|
||||||
lockdep_assert_held(&wq_pool_mutex);
|
lockdep_assert_held(&wq_pool_mutex);
|
||||||
|
|
||||||
|
@ -3210,13 +3211,25 @@ static struct worker_pool *get_unbound_pool(const struct workqueue_attrs *attrs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* if cpumask is contained inside a NUMA node, we belong to that node */
|
||||||
|
if (wq_numa_enabled) {
|
||||||
|
for_each_node(node) {
|
||||||
|
if (cpumask_subset(attrs->cpumask,
|
||||||
|
wq_numa_possible_cpumask[node])) {
|
||||||
|
target_node = node;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* nope, create a new one */
|
/* nope, create a new one */
|
||||||
pool = kzalloc(sizeof(*pool), GFP_KERNEL);
|
pool = kzalloc_node(sizeof(*pool), GFP_KERNEL, target_node);
|
||||||
if (!pool || init_worker_pool(pool) < 0)
|
if (!pool || init_worker_pool(pool) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
lockdep_set_subclass(&pool->lock, 1); /* see put_pwq() */
|
lockdep_set_subclass(&pool->lock, 1); /* see put_pwq() */
|
||||||
copy_workqueue_attrs(pool->attrs, attrs);
|
copy_workqueue_attrs(pool->attrs, attrs);
|
||||||
|
pool->node = target_node;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* no_numa isn't a worker_pool attribute, always clear it. See
|
* no_numa isn't a worker_pool attribute, always clear it. See
|
||||||
|
@ -3224,17 +3237,6 @@ static struct worker_pool *get_unbound_pool(const struct workqueue_attrs *attrs)
|
||||||
*/
|
*/
|
||||||
pool->attrs->no_numa = false;
|
pool->attrs->no_numa = false;
|
||||||
|
|
||||||
/* if cpumask is contained inside a NUMA node, we belong to that node */
|
|
||||||
if (wq_numa_enabled) {
|
|
||||||
for_each_node(node) {
|
|
||||||
if (cpumask_subset(pool->attrs->cpumask,
|
|
||||||
wq_numa_possible_cpumask[node])) {
|
|
||||||
pool->node = node;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (worker_pool_assign_id(pool) < 0)
|
if (worker_pool_assign_id(pool) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue