mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-25 16:11:45 +00:00
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>
This commit is contained in:
parent
b1f4ec172f
commit
cce1a1656c
1 changed files with 6 additions and 4 deletions
|
@ -58,8 +58,9 @@ struct cpu_workqueue_struct {
|
||||||
*/
|
*/
|
||||||
struct workqueue_struct {
|
struct workqueue_struct {
|
||||||
struct cpu_workqueue_struct *cpu_wq;
|
struct cpu_workqueue_struct *cpu_wq;
|
||||||
|
struct list_head list;
|
||||||
const char *name;
|
const char *name;
|
||||||
struct list_head list; /* Empty if single thread */
|
int singlethread;
|
||||||
int freezeable; /* Freeze threads during suspend */
|
int freezeable; /* Freeze threads during suspend */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -76,7 +77,7 @@ static cpumask_t cpu_populated_map __read_mostly;
|
||||||
/* If it's single threaded, it isn't in the list of workqueues. */
|
/* If it's single threaded, it isn't in the list of workqueues. */
|
||||||
static inline int is_single_threaded(struct workqueue_struct *wq)
|
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)
|
||||||
|
@ -401,7 +402,7 @@ static void flush_cpu_workqueue(struct cpu_workqueue_struct *cwq)
|
||||||
void fastcall flush_workqueue(struct workqueue_struct *wq)
|
void fastcall flush_workqueue(struct workqueue_struct *wq)
|
||||||
{
|
{
|
||||||
const cpumask_t *cpu_map = wq_cpu_map(wq);
|
const cpumask_t *cpu_map = wq_cpu_map(wq);
|
||||||
int cpu
|
int cpu;
|
||||||
|
|
||||||
might_sleep();
|
might_sleep();
|
||||||
for_each_cpu_mask(cpu, *cpu_map)
|
for_each_cpu_mask(cpu, *cpu_map)
|
||||||
|
@ -694,10 +695,11 @@ struct workqueue_struct *__create_workqueue(const char *name,
|
||||||
}
|
}
|
||||||
|
|
||||||
wq->name = name;
|
wq->name = name;
|
||||||
|
wq->singlethread = singlethread;
|
||||||
wq->freezeable = freezeable;
|
wq->freezeable = freezeable;
|
||||||
|
INIT_LIST_HEAD(&wq->list);
|
||||||
|
|
||||||
if (singlethread) {
|
if (singlethread) {
|
||||||
INIT_LIST_HEAD(&wq->list);
|
|
||||||
cwq = init_cpu_workqueue(wq, singlethread_cpu);
|
cwq = init_cpu_workqueue(wq, singlethread_cpu);
|
||||||
err = create_workqueue_thread(cwq, singlethread_cpu);
|
err = create_workqueue_thread(cwq, singlethread_cpu);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue