lkml.org 
[lkml]   [2012]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 5/6] workqueue: use system_highpri_wq for highpri workers in rebind_workers()
Date
In rebind_workers(), we do inserting a work to rebind to cpu for busy workers.
Currently, in this case, we use only system_wq. This makes a possible
error situation as there is mismatch between cwq->pool and worker->pool.

To prevent this, we should use system_highpri_wq for highpri worker
to match theses. This implements it.

Signed-off-by: Joonsoo Kim <js1304@gmail.com>

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 470b0eb..4c5733c1 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1738,6 +1738,7 @@ retry:
/* rebind busy workers */
for_each_busy_worker(worker, i, pos, gcwq) {
struct work_struct *rebind_work = &worker->rebind_work;
+ struct workqueue_struct *wq;

/* morph UNBOUND to REBIND */
worker->flags &= ~WORKER_UNBOUND;
@@ -1749,9 +1750,12 @@ retry:

/* wq doesn't matter, use the default one */
debug_work_activate(rebind_work);
- insert_work(get_cwq(gcwq->cpu, system_wq), rebind_work,
- worker->scheduled.next,
- work_color_to_flags(WORK_NO_COLOR));
+ wq = worker_pool_pri(worker->pool) ? system_highpri_wq :
+ system_wq;
+ insert_work(
+ get_cwq(gcwq->cpu, wq),
+ rebind_work, worker->scheduled.next,
+ work_color_to_flags(WORK_NO_COLOR));
}
}

--
1.7.9.5


\
 
 \ /
  Last update: 2012-08-14 21:42    [W:0.922 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site