[PATCH V2 03/15] workqueue: remname current worker->id to worker->id_in_pool

From: Lai Jiangshan
Date: Mon Feb 18 2013 - 11:13:50 EST


We will use worker->id for global worker id.

Signed-off-by: Lai Jiangshan <laijs@xxxxxxxxxxxxxx>
---
kernel/workqueue.c | 20 +++++++++++---------
kernel/workqueue_internal.h | 2 +-
2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index f90d0bd..764ad45 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1722,10 +1722,10 @@ static struct worker *create_worker(struct worker_pool *pool)
{
const char *pri = std_worker_pool_pri(pool) ? "H" : "";
struct worker *worker = NULL;
- int id = -1;
+ int id_in_pool = -1;

spin_lock_irq(&pool->lock);
- while (ida_get_new(&pool->worker_ida, &id)) {
+ while (ida_get_new(&pool->worker_ida, &id_in_pool)) {
spin_unlock_irq(&pool->lock);
if (!ida_pre_get(&pool->worker_ida, GFP_KERNEL))
goto fail;
@@ -1738,15 +1738,17 @@ static struct worker *create_worker(struct worker_pool *pool)
goto fail;

worker->pool = pool;
- worker->id = id;
+ worker->id_in_pool = id_in_pool;

if (pool->cpu != WORK_CPU_UNBOUND)
worker->task = kthread_create_on_node(worker_thread,
worker, cpu_to_node(pool->cpu),
- "kworker/%u:%d%s", pool->cpu, id, pri);
+ "kworker/%u:%d%s", pool->cpu,
+ id_in_pool, pri);
else
worker->task = kthread_create(worker_thread, worker,
- "kworker/u:%d%s", id, pri);
+ "kworker/u:%d%s",
+ id_in_pool, pri);
if (IS_ERR(worker->task))
goto fail;

@@ -1771,9 +1773,9 @@ static struct worker *create_worker(struct worker_pool *pool)

return worker;
fail:
- if (id >= 0) {
+ if (id_in_pool >= 0) {
spin_lock_irq(&pool->lock);
- ida_remove(&pool->worker_ida, id);
+ ida_remove(&pool->worker_ida, id_in_pool);
spin_unlock_irq(&pool->lock);
}
kfree(worker);
@@ -1809,7 +1811,7 @@ static void start_worker(struct worker *worker)
static void destroy_worker(struct worker *worker)
{
struct worker_pool *pool = worker->pool;
- int id = worker->id;
+ int id_in_pool = worker->id_in_pool;

/* sanity check frenzy */
BUG_ON(worker->current_work);
@@ -1829,7 +1831,7 @@ static void destroy_worker(struct worker *worker)
kfree(worker);

spin_lock_irq(&pool->lock);
- ida_remove(&pool->worker_ida, id);
+ ida_remove(&pool->worker_ida, id_in_pool);
}

static void idle_worker_timeout(unsigned long __pool)
diff --git a/kernel/workqueue_internal.h b/kernel/workqueue_internal.h
index 328be4a..e6afb59 100644
--- a/kernel/workqueue_internal.h
+++ b/kernel/workqueue_internal.h
@@ -35,7 +35,7 @@ struct worker {
/* 64 bytes boundary on 64bit, 32 on 32bit */
unsigned long last_active; /* L: last active timestamp */
unsigned int flags; /* X: flags */
- int id; /* I: worker id */
+ int id_in_pool; /* I: worker id in the pool */

/* for rebinding worker to CPU */
struct work_struct rebind_work; /* L: for busy worker */
--
1.7.7.6

--
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/