workqueue: make it clear that WQ_DRAINING is an internal flag

We're gonna add another internal WQ flag.  Let's make the distinction
clear.  Prefix WQ_DRAINING with __ and move it to bit 16.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com>
This commit is contained in:
Tejun Heo 2013-03-12 11:30:04 -07:00
parent 9e8cd2f589
commit 618b01eb42
2 changed files with 5 additions and 5 deletions

View File

@ -294,7 +294,7 @@ enum {
WQ_HIGHPRI = 1 << 4, /* high priority */ WQ_HIGHPRI = 1 << 4, /* high priority */
WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */ WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */
WQ_DRAINING = 1 << 6, /* internal: workqueue is draining */ __WQ_DRAINING = 1 << 16, /* internal: workqueue is draining */
WQ_MAX_ACTIVE = 512, /* I like 512, better ideas? */ WQ_MAX_ACTIVE = 512, /* I like 512, better ideas? */
WQ_MAX_UNBOUND_PER_CPU = 4, /* 4 * #cpus for unbound wq */ WQ_MAX_UNBOUND_PER_CPU = 4, /* 4 * #cpus for unbound wq */

View File

@ -1225,7 +1225,7 @@ static void __queue_work(int cpu, struct workqueue_struct *wq,
debug_work_activate(work); debug_work_activate(work);
/* if dying, only works from the same workqueue are allowed */ /* if dying, only works from the same workqueue are allowed */
if (unlikely(wq->flags & WQ_DRAINING) && if (unlikely(wq->flags & __WQ_DRAINING) &&
WARN_ON_ONCE(!is_chained_work(wq))) WARN_ON_ONCE(!is_chained_work(wq)))
return; return;
retry: retry:
@ -2763,11 +2763,11 @@ void drain_workqueue(struct workqueue_struct *wq)
/* /*
* __queue_work() needs to test whether there are drainers, is much * __queue_work() needs to test whether there are drainers, is much
* hotter than drain_workqueue() and already looks at @wq->flags. * hotter than drain_workqueue() and already looks at @wq->flags.
* Use WQ_DRAINING so that queue doesn't have to check nr_drainers. * Use __WQ_DRAINING so that queue doesn't have to check nr_drainers.
*/ */
spin_lock_irq(&workqueue_lock); spin_lock_irq(&workqueue_lock);
if (!wq->nr_drainers++) if (!wq->nr_drainers++)
wq->flags |= WQ_DRAINING; wq->flags |= __WQ_DRAINING;
spin_unlock_irq(&workqueue_lock); spin_unlock_irq(&workqueue_lock);
reflush: reflush:
flush_workqueue(wq); flush_workqueue(wq);
@ -2795,7 +2795,7 @@ reflush:
spin_lock(&workqueue_lock); spin_lock(&workqueue_lock);
if (!--wq->nr_drainers) if (!--wq->nr_drainers)
wq->flags &= ~WQ_DRAINING; wq->flags &= ~__WQ_DRAINING;
spin_unlock(&workqueue_lock); spin_unlock(&workqueue_lock);
local_irq_enable(); local_irq_enable();