mirror of
https://github.com/torvalds/linux.git
synced 2026-09-12 20:53:03 +02:00
workqueue: release pwq pools by pool type
Add is_percpu_pool() and test the pool directly for per cpu. Convert the other open-coded pool->cpu checks -- in put_unbound_pool(), pool_allowed_cpus() and the workqueue watchdog -- to the same helper. No functional change. Signed-off-by: Breno Leitao <leitao@debian.org> Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
parent
a6a80c1cc6
commit
3180ee71b6
|
|
@ -1604,6 +1604,12 @@ work_func_t wq_worker_last_func(struct task_struct *task)
|
|||
return worker->last_func;
|
||||
}
|
||||
|
||||
/* True if @pool is a static per-cpu pool rather than an unbound one. */
|
||||
static bool is_percpu_pool(struct worker_pool *pool)
|
||||
{
|
||||
return pool->cpu >= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* wq_node_nr_active - Determine wq_node_nr_active to use
|
||||
* @wq: workqueue of interest
|
||||
|
|
@ -2753,7 +2759,7 @@ static struct worker *alloc_worker(int node)
|
|||
|
||||
static cpumask_t *pool_allowed_cpus(struct worker_pool *pool)
|
||||
{
|
||||
if (pool->cpu < 0 && pool->attrs->affn_strict)
|
||||
if (!is_percpu_pool(pool) && pool->attrs->affn_strict)
|
||||
return pool->attrs->__pod_cpumask;
|
||||
else
|
||||
return pool->attrs->cpumask;
|
||||
|
|
@ -5121,7 +5127,7 @@ static void put_unbound_pool(struct worker_pool *pool)
|
|||
return;
|
||||
|
||||
/* sanity checks */
|
||||
if (WARN_ON(!(pool->cpu < 0)) ||
|
||||
if (WARN_ON(is_percpu_pool(pool)) ||
|
||||
WARN_ON(!list_empty(&pool->worklist)))
|
||||
return;
|
||||
|
||||
|
|
@ -5273,7 +5279,7 @@ static void pwq_release_workfn(struct kthread_work *work)
|
|||
mutex_unlock(&wq->mutex);
|
||||
}
|
||||
|
||||
if (wq->flags & WQ_UNBOUND) {
|
||||
if (!is_percpu_pool(pool)) {
|
||||
mutex_lock(&wq_pool_mutex);
|
||||
put_unbound_pool(pool);
|
||||
mutex_unlock(&wq_pool_mutex);
|
||||
|
|
@ -7949,7 +7955,7 @@ static void wq_watchdog_timer_fn(struct timer_list *unused)
|
|||
lockup_detected = true;
|
||||
stall_time = jiffies_to_msecs(now - pool_ts) / 1000;
|
||||
max_stall_time = max(max_stall_time, stall_time);
|
||||
if (pool->cpu >= 0 && !(pool->flags & POOL_BH)) {
|
||||
if (is_percpu_pool(pool) && !(pool->flags & POOL_BH)) {
|
||||
pool->cpu_stall = true;
|
||||
cpu_pool_stall = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user