Skip to content

Commit

Permalink
workqueue: invert the order between pool->lock and wq_mayday_lock
Browse files Browse the repository at this point in the history
Currently, pool->lock nests inside pool->lock.  There's no inherent
reason for this order.  The only place where the two locks are held
together is pool_mayday_timeout() and it just got decided that way.

This nesting order turns out to complicate things with the planned
rescuer_thread() update.  Let's invert them.  This doesn't cause any
behavior differences.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: NeilBrown <neilb@suse.de>
Cc: Dongsu Park <dongsu.park@profitbricks.com>
  • Loading branch information
Tejun Heo committed Dec 8, 2014
1 parent 0479c8c commit b2d8290
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kernel/workqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -1804,8 +1804,8 @@ static void pool_mayday_timeout(unsigned long __pool)
struct worker_pool *pool = (void *)__pool;
struct work_struct *work;

spin_lock_irq(&wq_mayday_lock); /* for wq->maydays */
spin_lock(&pool->lock);
spin_lock_irq(&pool->lock);
spin_lock(&wq_mayday_lock); /* for wq->maydays */

if (need_to_create_worker(pool)) {
/*
Expand All @@ -1818,8 +1818,8 @@ static void pool_mayday_timeout(unsigned long __pool)
send_mayday(work);
}

spin_unlock(&pool->lock);
spin_unlock_irq(&wq_mayday_lock);
spin_unlock(&wq_mayday_lock);
spin_unlock_irq(&pool->lock);

mod_timer(&pool->mayday_timer, jiffies + MAYDAY_INTERVAL);
}
Expand Down

0 comments on commit b2d8290

Please sign in to comment.