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>
*/
struct workqueue_struct {
struct cpu_workqueue_struct *cpu_wq;
*/
struct workqueue_struct {
struct cpu_workqueue_struct *cpu_wq;
- struct list_head list; /* Empty if single thread */
int freezeable; /* Freeze threads during suspend */
};
int freezeable; /* Freeze threads during suspend */
};
/* If it's single threaded, it isn't in the list of workqueues. */
static inline int is_single_threaded(struct workqueue_struct *wq)
{
/* If it's single threaded, it isn't in the list of workqueues. */
static inline int is_single_threaded(struct workqueue_struct *wq)
{
- return list_empty(&wq->list);
+ return wq->singlethread;
}
static const cpumask_t *wq_cpu_map(struct workqueue_struct *wq)
}
static const cpumask_t *wq_cpu_map(struct workqueue_struct *wq)
void fastcall flush_workqueue(struct workqueue_struct *wq)
{
const cpumask_t *cpu_map = wq_cpu_map(wq);
void fastcall flush_workqueue(struct workqueue_struct *wq)
{
const cpumask_t *cpu_map = wq_cpu_map(wq);
might_sleep();
for_each_cpu_mask(cpu, *cpu_map)
might_sleep();
for_each_cpu_mask(cpu, *cpu_map)
+ wq->singlethread = singlethread;
wq->freezeable = freezeable;
wq->freezeable = freezeable;
+ INIT_LIST_HEAD(&wq->list);
- INIT_LIST_HEAD(&wq->list);
cwq = init_cpu_workqueue(wq, singlethread_cpu);
err = create_workqueue_thread(cwq, singlethread_cpu);
} else {
cwq = init_cpu_workqueue(wq, singlethread_cpu);
err = create_workqueue_thread(cwq, singlethread_cpu);
} else {