mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
workqueue: Move worker_set/clr_flags() upwards
They are going to be used in wq_worker_stopping(). Move them upwards. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Lai Jiangshan <jiangshanlai@gmail.com>
This commit is contained in:
@@ -879,6 +879,60 @@ static void wake_up_worker(struct worker_pool *pool)
|
|||||||
wake_up_process(worker->task);
|
wake_up_process(worker->task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* worker_set_flags - set worker flags and adjust nr_running accordingly
|
||||||
|
* @worker: self
|
||||||
|
* @flags: flags to set
|
||||||
|
*
|
||||||
|
* Set @flags in @worker->flags and adjust nr_running accordingly.
|
||||||
|
*
|
||||||
|
* CONTEXT:
|
||||||
|
* raw_spin_lock_irq(pool->lock)
|
||||||
|
*/
|
||||||
|
static inline void worker_set_flags(struct worker *worker, unsigned int flags)
|
||||||
|
{
|
||||||
|
struct worker_pool *pool = worker->pool;
|
||||||
|
|
||||||
|
WARN_ON_ONCE(worker->task != current);
|
||||||
|
|
||||||
|
/* If transitioning into NOT_RUNNING, adjust nr_running. */
|
||||||
|
if ((flags & WORKER_NOT_RUNNING) &&
|
||||||
|
!(worker->flags & WORKER_NOT_RUNNING)) {
|
||||||
|
pool->nr_running--;
|
||||||
|
}
|
||||||
|
|
||||||
|
worker->flags |= flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* worker_clr_flags - clear worker flags and adjust nr_running accordingly
|
||||||
|
* @worker: self
|
||||||
|
* @flags: flags to clear
|
||||||
|
*
|
||||||
|
* Clear @flags in @worker->flags and adjust nr_running accordingly.
|
||||||
|
*
|
||||||
|
* CONTEXT:
|
||||||
|
* raw_spin_lock_irq(pool->lock)
|
||||||
|
*/
|
||||||
|
static inline void worker_clr_flags(struct worker *worker, unsigned int flags)
|
||||||
|
{
|
||||||
|
struct worker_pool *pool = worker->pool;
|
||||||
|
unsigned int oflags = worker->flags;
|
||||||
|
|
||||||
|
WARN_ON_ONCE(worker->task != current);
|
||||||
|
|
||||||
|
worker->flags &= ~flags;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If transitioning out of NOT_RUNNING, increment nr_running. Note
|
||||||
|
* that the nested NOT_RUNNING is not a noop. NOT_RUNNING is mask
|
||||||
|
* of multiple flags, not a single flag.
|
||||||
|
*/
|
||||||
|
if ((flags & WORKER_NOT_RUNNING) && (oflags & WORKER_NOT_RUNNING))
|
||||||
|
if (!(worker->flags & WORKER_NOT_RUNNING))
|
||||||
|
pool->nr_running++;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* wq_worker_running - a worker is running again
|
* wq_worker_running - a worker is running again
|
||||||
* @task: task waking up
|
* @task: task waking up
|
||||||
@@ -983,60 +1037,6 @@ work_func_t wq_worker_last_func(struct task_struct *task)
|
|||||||
return worker->last_func;
|
return worker->last_func;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* worker_set_flags - set worker flags and adjust nr_running accordingly
|
|
||||||
* @worker: self
|
|
||||||
* @flags: flags to set
|
|
||||||
*
|
|
||||||
* Set @flags in @worker->flags and adjust nr_running accordingly.
|
|
||||||
*
|
|
||||||
* CONTEXT:
|
|
||||||
* raw_spin_lock_irq(pool->lock)
|
|
||||||
*/
|
|
||||||
static inline void worker_set_flags(struct worker *worker, unsigned int flags)
|
|
||||||
{
|
|
||||||
struct worker_pool *pool = worker->pool;
|
|
||||||
|
|
||||||
WARN_ON_ONCE(worker->task != current);
|
|
||||||
|
|
||||||
/* If transitioning into NOT_RUNNING, adjust nr_running. */
|
|
||||||
if ((flags & WORKER_NOT_RUNNING) &&
|
|
||||||
!(worker->flags & WORKER_NOT_RUNNING)) {
|
|
||||||
pool->nr_running--;
|
|
||||||
}
|
|
||||||
|
|
||||||
worker->flags |= flags;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* worker_clr_flags - clear worker flags and adjust nr_running accordingly
|
|
||||||
* @worker: self
|
|
||||||
* @flags: flags to clear
|
|
||||||
*
|
|
||||||
* Clear @flags in @worker->flags and adjust nr_running accordingly.
|
|
||||||
*
|
|
||||||
* CONTEXT:
|
|
||||||
* raw_spin_lock_irq(pool->lock)
|
|
||||||
*/
|
|
||||||
static inline void worker_clr_flags(struct worker *worker, unsigned int flags)
|
|
||||||
{
|
|
||||||
struct worker_pool *pool = worker->pool;
|
|
||||||
unsigned int oflags = worker->flags;
|
|
||||||
|
|
||||||
WARN_ON_ONCE(worker->task != current);
|
|
||||||
|
|
||||||
worker->flags &= ~flags;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If transitioning out of NOT_RUNNING, increment nr_running. Note
|
|
||||||
* that the nested NOT_RUNNING is not a noop. NOT_RUNNING is mask
|
|
||||||
* of multiple flags, not a single flag.
|
|
||||||
*/
|
|
||||||
if ((flags & WORKER_NOT_RUNNING) && (oflags & WORKER_NOT_RUNNING))
|
|
||||||
if (!(worker->flags & WORKER_NOT_RUNNING))
|
|
||||||
pool->nr_running++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* find_worker_executing_work - find worker which is executing a work
|
* find_worker_executing_work - find worker which is executing a work
|
||||||
* @pool: pool of interest
|
* @pool: pool of interest
|
||||||
|
Reference in New Issue
Block a user