]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Revert "workqueue: Factor out pwq_is_empty()"
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2024 14:36:48 +0000 (16:36 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Apr 2024 18:23:07 +0000 (20:23 +0200)
This reverts commit bad184d26a4f68aa00ad75502f9669950a790f71 which is
commit afa87ce85379e2d93863fce595afdb5771a84004 upstream.

The workqueue patches backported to 6.6.y caused some reported
regressions, so revert them for now.

Reported-by: Thorsten Leemhuis <regressions@leemhuis.info>
Cc: Tejun Heo <tj@kernel.org>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Sasha Levin <sashal@kernel.org>
Cc: Audra Mitchell <audra@redhat.com>
Link: https://lore.kernel.org/all/ce4c2f67-c298-48a0-87a3-f933d646c73b@leemhuis.info/
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/workqueue.c

index 3eb0408133ada1ca2fd452680d8959a1235e3f2b..3aa48ba8c717518083e18f787481b433caeeb25c 100644 (file)
@@ -1450,11 +1450,6 @@ static void put_pwq_unlocked(struct pool_workqueue *pwq)
        }
 }
 
-static bool pwq_is_empty(struct pool_workqueue *pwq)
-{
-       return !pwq->nr_active && list_empty(&pwq->inactive_works);
-}
-
 static void pwq_activate_inactive_work(struct work_struct *work)
 {
        struct pool_workqueue *pwq = get_work_pwq(work);
@@ -3324,7 +3319,7 @@ reflush:
                bool drained;
 
                raw_spin_lock_irq(&pwq->pool->lock);
-               drained = pwq_is_empty(pwq);
+               drained = !pwq->nr_active && list_empty(&pwq->inactive_works);
                raw_spin_unlock_irq(&pwq->pool->lock);
 
                if (drained)
@@ -4784,7 +4779,7 @@ static bool pwq_busy(struct pool_workqueue *pwq)
 
        if ((pwq != pwq->wq->dfl_pwq) && (pwq->refcnt > 1))
                return true;
-       if (!pwq_is_empty(pwq))
+       if (pwq->nr_active || !list_empty(&pwq->inactive_works))
                return true;
 
        return false;
@@ -5222,7 +5217,7 @@ void show_one_workqueue(struct workqueue_struct *wq)
        unsigned long flags;
 
        for_each_pwq(pwq, wq) {
-               if (!pwq_is_empty(pwq)) {
+               if (pwq->nr_active || !list_empty(&pwq->inactive_works)) {
                        idle = false;
                        break;
                }
@@ -5234,7 +5229,7 @@ void show_one_workqueue(struct workqueue_struct *wq)
 
        for_each_pwq(pwq, wq) {
                raw_spin_lock_irqsave(&pwq->pool->lock, flags);
-               if (!pwq_is_empty(pwq)) {
+               if (pwq->nr_active || !list_empty(&pwq->inactive_works)) {
                        /*
                         * Defer printing to avoid deadlocks in console
                         * drivers that queue work while holding locks