[PATCH 11/11 V5] workqueue: remove manager_mutex
From: Lai Jiangshan
Date: Wed Sep 05 2012 - 06:36:45 EST
no one except manage_workers() use it. remove it.
manage_workers() will use ->manager instead.
Signed-off-by: Lai Jiangshan <laijs@xxxxxxxxxxxxxx>
---
kernel/workqueue.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 5fb712a..eee3fad 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -163,7 +163,6 @@ struct worker_pool {
struct timer_list mayday_timer; /* L: SOS timer for workers */
struct worker *manager; /* L: manager worker */
- struct mutex manager_mutex; /* mutex manager should hold */
struct ida worker_ida; /* L: for worker IDs */
};
@@ -678,7 +677,7 @@ static bool need_to_manage_workers(struct worker_pool *pool)
/* Do we have too many workers and should some go away? */
static bool too_many_workers(struct worker_pool *pool)
{
- bool managing = mutex_is_locked(&pool->manager_mutex);
+ bool managing = !!pool->manager;
int nr_idle = pool->nr_idle + managing; /* manager is considered idle */
int nr_busy = pool->nr_workers - nr_idle;
@@ -2104,7 +2103,7 @@ static bool manage_workers(struct worker *worker)
struct worker_pool *pool = worker->pool;
bool ret = false;
- if (!mutex_trylock(&pool->manager_mutex))
+ if (pool->manager)
return ret;
pool->manager = worker;
@@ -2118,7 +2117,6 @@ static bool manage_workers(struct worker *worker)
ret |= maybe_create_worker(pool);
ret |= maybe_rebind_manager(worker);
- mutex_unlock(&pool->manager_mutex);
pool->manager = NULL;
return ret;
@@ -3785,7 +3783,6 @@ static int __init init_workqueues(void)
(unsigned long)pool);
pool->manager = NULL;
- mutex_init(&pool->manager_mutex);
ida_init(&pool->worker_ida);
}
}
--
1.7.4.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/