Merge tag 'pm-5.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
[linux-2.6-microblaze.git] / kernel / workqueue.c
index 437935e..9880b6c 100644 (file)
@@ -1327,6 +1327,9 @@ static void insert_work(struct pool_workqueue *pwq, struct work_struct *work,
 {
        struct worker_pool *pool = pwq->pool;
 
+       /* record the work call stack in order to print it in KASAN reports */
+       kasan_record_aux_stack(work);
+
        /* we own @work, set data and link */
        set_work_pwq(work, pwq, extra_flags);
        list_add_tail(&work->entry, head);
@@ -3728,17 +3731,24 @@ static void pwq_adjust_max_active(struct pool_workqueue *pwq)
         * is updated and visible.
         */
        if (!freezable || !workqueue_freezing) {
+               bool kick = false;
+
                pwq->max_active = wq->saved_max_active;
 
                while (!list_empty(&pwq->delayed_works) &&
-                      pwq->nr_active < pwq->max_active)
+                      pwq->nr_active < pwq->max_active) {
                        pwq_activate_first_delayed(pwq);
+                       kick = true;
+               }
 
                /*
                 * Need to kick a worker after thawed or an unbound wq's
-                * max_active is bumped.  It's a slow path.  Do it always.
+                * max_active is bumped. In realtime scenarios, always kicking a
+                * worker will cause interference on the isolated cpu cores, so
+                * let's kick iff work items were activated.
                 */
-               wake_up_worker(pwq->pool);
+               if (kick)
+                       wake_up_worker(pwq->pool);
        } else {
                pwq->max_active = 0;
        }
@@ -4908,6 +4918,10 @@ static void unbind_workers(int cpu)
                pool->flags |= POOL_DISASSOCIATED;
 
                raw_spin_unlock_irq(&pool->lock);
+
+               for_each_pool_worker(worker, pool)
+                       WARN_ON_ONCE(set_cpus_allowed_ptr(worker->task, cpu_active_mask) < 0);
+
                mutex_unlock(&wq_pool_attach_mutex);
 
                /*