aboutsummaryrefslogtreecommitdiff
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c39
1 files changed, 7 insertions, 32 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index c2f9d6ca7e5..db7a6ac7c0a 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1881,12 +1881,6 @@ static void send_mayday(struct work_struct *work)
/* mayday mayday mayday */
if (list_empty(&pwq->mayday_node)) {
- /*
- * If @pwq is for an unbound wq, its base ref may be put at
- * any time due to an attribute change. Pin @pwq until the
- * rescuer is done with it.
- */
- get_pwq(pwq);
list_add_tail(&pwq->mayday_node, &wq->maydays);
wake_up_process(wq->rescuer->task);
}
@@ -2362,7 +2356,6 @@ static int rescuer_thread(void *__rescuer)
struct worker *rescuer = __rescuer;
struct workqueue_struct *wq = rescuer->rescue_wq;
struct list_head *scheduled = &rescuer->scheduled;
- bool should_stop;
set_user_nice(current, RESCUER_NICE_LEVEL);
@@ -2374,15 +2367,11 @@ static int rescuer_thread(void *__rescuer)
repeat:
set_current_state(TASK_INTERRUPTIBLE);
- /*
- * By the time the rescuer is requested to stop, the workqueue
- * shouldn't have any work pending, but @wq->maydays may still have
- * pwq(s) queued. This can happen by non-rescuer workers consuming
- * all the work items before the rescuer got to them. Go through
- * @wq->maydays processing before acting on should_stop so that the
- * list is always empty on exit.
- */
- should_stop = kthread_should_stop();
+ if (kthread_should_stop()) {
+ __set_current_state(TASK_RUNNING);
+ rescuer->task->flags &= ~PF_WQ_WORKER;
+ return 0;
+ }
/* see whether any pwq is asking for help */
spin_lock_irq(&wq_mayday_lock);
@@ -2414,12 +2403,6 @@ repeat:
process_scheduled_works(rescuer);
/*
- * Put the reference grabbed by send_mayday(). @pool won't
- * go away while we're holding its lock.
- */
- put_pwq(pwq);
-
- /*
* Leave this pool. If keep_working() is %true, notify a
* regular worker; otherwise, we end up with 0 concurrency
* and stalling the execution.
@@ -2434,12 +2417,6 @@ repeat:
spin_unlock_irq(&wq_mayday_lock);
- if (should_stop) {
- __set_current_state(TASK_RUNNING);
- rescuer->task->flags &= ~PF_WQ_WORKER;
- return 0;
- }
-
/* rescuers should never participate in concurrency management */
WARN_ON_ONCE(!(rescuer->flags & WORKER_NOT_RUNNING));
schedule();
@@ -3373,7 +3350,6 @@ int workqueue_sysfs_register(struct workqueue_struct *wq)
}
}
- dev_set_uevent_suppress(&wq_dev->dev, false);
kobject_uevent(&wq_dev->dev.kobj, KOBJ_ADD);
return 0;
}
@@ -4067,8 +4043,7 @@ static void wq_update_unbound_numa(struct workqueue_struct *wq, int cpu,
if (!pwq) {
pr_warning("workqueue: allocation failed while updating NUMA affinity of \"%s\"\n",
wq->name);
- mutex_lock(&wq->mutex);
- goto use_dfl_pwq;
+ goto out_unlock;
}
/*
@@ -4968,7 +4943,7 @@ static void __init wq_numa_init(void)
BUG_ON(!tbl);
for_each_node(node)
- BUG_ON(!zalloc_cpumask_var_node(&tbl[node], GFP_KERNEL,
+ BUG_ON(!alloc_cpumask_var_node(&tbl[node], GFP_KERNEL,
node_online(node) ? node : NUMA_NO_NODE));
for_each_possible_cpu(cpu) {