aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2007-05-09 05:34:13 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-09 15:30:52 -0400
commitcce1a1656c9a3fdc6c6c1029b576e4ab6ecaac37 (patch)
tree016a79e653156e32766f17bd801ffd0e4dd3a79f
parentb1f4ec172f75bc2f5cc4f4be69b5587660a955d2 (diff)
workqueue: introduce workqueue_struct->singlethread
Add explicit workqueue_struct->singlethread flag. This lessens .text a little, but most importantly this allows us to manipulate wq->list without changine the meaning of is_single_threaded(). Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Cc: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--kernel/workqueue.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 6308a4bc6a82..32b1091f21ef 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -58,8 +58,9 @@ struct cpu_workqueue_struct {
58 */ 58 */
59struct workqueue_struct { 59struct workqueue_struct {
60 struct cpu_workqueue_struct *cpu_wq; 60 struct cpu_workqueue_struct *cpu_wq;
61 struct list_head list;
61 const char *name; 62 const char *name;
62 struct list_head list; /* Empty if single thread */ 63 int singlethread;
63 int freezeable; /* Freeze threads during suspend */ 64 int freezeable; /* Freeze threads during suspend */
64}; 65};
65 66
@@ -76,7 +77,7 @@ static cpumask_t cpu_populated_map __read_mostly;
76/* If it's single threaded, it isn't in the list of workqueues. */ 77/* If it's single threaded, it isn't in the list of workqueues. */
77static inline int is_single_threaded(struct workqueue_struct *wq) 78static inline int is_single_threaded(struct workqueue_struct *wq)
78{ 79{
79 return list_empty(&wq->list); 80 return wq->singlethread;
80} 81}
81 82
82static const cpumask_t *wq_cpu_map(struct workqueue_struct *wq) 83static const cpumask_t *wq_cpu_map(struct workqueue_struct *wq)
@@ -401,7 +402,7 @@ static void flush_cpu_workqueue(struct cpu_workqueue_struct *cwq)
401void fastcall flush_workqueue(struct workqueue_struct *wq) 402void fastcall flush_workqueue(struct workqueue_struct *wq)
402{ 403{
403 const cpumask_t *cpu_map = wq_cpu_map(wq); 404 const cpumask_t *cpu_map = wq_cpu_map(wq);
404 int cpu 405 int cpu;
405 406
406 might_sleep(); 407 might_sleep();
407 for_each_cpu_mask(cpu, *cpu_map) 408 for_each_cpu_mask(cpu, *cpu_map)
@@ -694,10 +695,11 @@ struct workqueue_struct *__create_workqueue(const char *name,
694 } 695 }
695 696
696 wq->name = name; 697 wq->name = name;
698 wq->singlethread = singlethread;
697 wq->freezeable = freezeable; 699 wq->freezeable = freezeable;
700 INIT_LIST_HEAD(&wq->list);
698 701
699 if (singlethread) { 702 if (singlethread) {
700 INIT_LIST_HEAD(&wq->list);
701 cwq = init_cpu_workqueue(wq, singlethread_cpu); 703 cwq = init_cpu_workqueue(wq, singlethread_cpu);
702 err = create_workqueue_thread(cwq, singlethread_cpu); 704 err = create_workqueue_thread(cwq, singlethread_cpu);
703 } else { 705 } else {