Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 365497
b: refs/heads/master
c: 493008a
h: refs/heads/master
i:
  365495: 0dbcd85
v: v3
  • Loading branch information
Tejun Heo committed Mar 12, 2013
1 parent f4ff47a commit 6c350e3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ac6104cdf87cc162b0a0d78280d1dcb9752e25bb
refs/heads/master: 493008a8e475771a2126e0ce95a73e35b371d277
1 change: 0 additions & 1 deletion trunk/include/linux/workqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ enum {
WQ_CPU_INTENSIVE = 1 << 5, /* cpu instensive workqueue */

WQ_DRAINING = 1 << 6, /* internal: workqueue is draining */
WQ_RESCUER = 1 << 7, /* internal: workqueue has rescuer */

WQ_MAX_ACTIVE = 512, /* I like 512, better ideas? */
WQ_MAX_UNBOUND_PER_CPU = 4, /* 4 * #cpus for unbound wq */
Expand Down
22 changes: 10 additions & 12 deletions trunk/kernel/workqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -1827,7 +1827,7 @@ static void send_mayday(struct work_struct *work)

lockdep_assert_held(&workqueue_lock);

if (!(wq->flags & WQ_RESCUER))
if (!wq->rescuer)
return;

/* mayday mayday mayday */
Expand Down Expand Up @@ -2285,7 +2285,7 @@ static int worker_thread(void *__worker)
* @__rescuer: self
*
* Workqueue rescuer thread function. There's one rescuer for each
* workqueue which has WQ_RESCUER set.
* workqueue which has WQ_MEM_RECLAIM set.
*
* Regular work processing on a pool may block trying to create a new
* worker which uses GFP_KERNEL allocation which has slight chance of
Expand Down Expand Up @@ -2769,7 +2769,7 @@ static bool start_flush_work(struct work_struct *work, struct wq_barrier *barr)
* flusher is not running on the same workqueue by verifying write
* access.
*/
if (pwq->wq->saved_max_active == 1 || pwq->wq->flags & WQ_RESCUER)
if (pwq->wq->saved_max_active == 1 || pwq->wq->rescuer)
lock_map_acquire(&pwq->wq->lockdep_map);
else
lock_map_acquire_read(&pwq->wq->lockdep_map);
Expand Down Expand Up @@ -3412,13 +3412,6 @@ struct workqueue_struct *__alloc_workqueue_key(const char *fmt,
va_end(args);
va_end(args1);

/*
* Workqueues which may be used during memory reclaim should
* have a rescuer to guarantee forward progress.
*/
if (flags & WQ_MEM_RECLAIM)
flags |= WQ_RESCUER;

max_active = max_active ?: WQ_DFL_ACTIVE;
max_active = wq_clamp_max_active(max_active, flags, wq->name);

Expand Down Expand Up @@ -3449,7 +3442,11 @@ struct workqueue_struct *__alloc_workqueue_key(const char *fmt,
}
local_irq_enable();

if (flags & WQ_RESCUER) {
/*
* Workqueues which may be used during memory reclaim should
* have a rescuer to guarantee forward progress.
*/
if (flags & WQ_MEM_RECLAIM) {
struct worker *rescuer;

wq->rescuer = rescuer = alloc_worker();
Expand Down Expand Up @@ -3533,9 +3530,10 @@ void destroy_workqueue(struct workqueue_struct *wq)

spin_unlock_irq(&workqueue_lock);

if (wq->flags & WQ_RESCUER) {
if (wq->rescuer) {
kthread_stop(wq->rescuer->task);
kfree(wq->rescuer);
wq->rescuer = NULL;
}

/*
Expand Down

0 comments on commit 6c350e3

Please sign in to comment.