linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] workqueue: Use wake_up_worker() to wake up first idle worker
@ 2020-07-27 12:29 linmiaohe
  2020-08-03  7:48 ` Lai Jiangshan
  2020-09-04 17:11 ` Tejun Heo
  0 siblings, 2 replies; 4+ messages in thread
From: linmiaohe @ 2020-07-27 12:29 UTC (permalink / raw)
  To: tj, jiangshanlai; +Cc: linux-kernel, linmiaohe

From: Miaohe Lin <linmiaohe@huawei.com>

Use wrapper function wake_up_worker() to wake up first idle worker.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 kernel/workqueue.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index c41c3c17b86a..5302f227f38f 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -864,7 +864,7 @@ void wq_worker_running(struct task_struct *task)
  */
 void wq_worker_sleeping(struct task_struct *task)
 {
-	struct worker *next, *worker = kthread_data(task);
+	struct worker *worker = kthread_data(task);
 	struct worker_pool *pool;
 
 	/*
@@ -896,11 +896,9 @@ void wq_worker_sleeping(struct task_struct *task)
 	 * lock is safe.
 	 */
 	if (atomic_dec_and_test(&pool->nr_running) &&
-	    !list_empty(&pool->worklist)) {
-		next = first_idle_worker(pool);
-		if (next)
-			wake_up_process(next->task);
-	}
+	    !list_empty(&pool->worklist))
+		wake_up_worker(pool);
+
 	raw_spin_unlock_irq(&pool->lock);
 }
 
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] workqueue: Use wake_up_worker() to wake up first idle worker
  2020-07-27 12:29 [PATCH] workqueue: Use wake_up_worker() to wake up first idle worker linmiaohe
@ 2020-08-03  7:48 ` Lai Jiangshan
  2020-09-04 17:11 ` Tejun Heo
  1 sibling, 0 replies; 4+ messages in thread
From: Lai Jiangshan @ 2020-08-03  7:48 UTC (permalink / raw)
  To: linmiaohe; +Cc: Tejun Heo, LKML

On Mon, Jul 27, 2020 at 8:27 PM linmiaohe <linmiaohe@huawei.com> wrote:
>
> From: Miaohe Lin <linmiaohe@huawei.com>
>
> Use wrapper function wake_up_worker() to wake up first idle worker.
>
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

Reviewed-by: Lai Jiangshan <jiangshanlai@gmail.com>

> ---
>  kernel/workqueue.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index c41c3c17b86a..5302f227f38f 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -864,7 +864,7 @@ void wq_worker_running(struct task_struct *task)
>   */
>  void wq_worker_sleeping(struct task_struct *task)
>  {
> -       struct worker *next, *worker = kthread_data(task);
> +       struct worker *worker = kthread_data(task);
>         struct worker_pool *pool;
>
>         /*
> @@ -896,11 +896,9 @@ void wq_worker_sleeping(struct task_struct *task)
>          * lock is safe.
>          */
>         if (atomic_dec_and_test(&pool->nr_running) &&
> -           !list_empty(&pool->worklist)) {
> -               next = first_idle_worker(pool);
> -               if (next)
> -                       wake_up_process(next->task);
> -       }
> +           !list_empty(&pool->worklist))
> +               wake_up_worker(pool);
> +
>         raw_spin_unlock_irq(&pool->lock);
>  }
>
> --
> 2.19.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] workqueue: Use wake_up_worker() to wake up first idle worker
  2020-07-27 12:29 [PATCH] workqueue: Use wake_up_worker() to wake up first idle worker linmiaohe
  2020-08-03  7:48 ` Lai Jiangshan
@ 2020-09-04 17:11 ` Tejun Heo
  1 sibling, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2020-09-04 17:11 UTC (permalink / raw)
  To: linmiaohe; +Cc: jiangshanlai, linux-kernel

On Mon, Jul 27, 2020 at 08:29:29PM +0800, linmiaohe wrote:
> From: Miaohe Lin <linmiaohe@huawei.com>
> 
> Use wrapper function wake_up_worker() to wake up first idle worker.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

Applied to wq/for-5.10.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] workqueue: Use wake_up_worker() to wake up first idle worker
@ 2020-08-24 12:00 linmiaohe
  0 siblings, 0 replies; 4+ messages in thread
From: linmiaohe @ 2020-08-24 12:00 UTC (permalink / raw)
  To: tj, jiangshanlai; +Cc: linux-kernel

friendly ping :)

>Miaohe Lin <linmiaohe@huawei.com> wrote:
>From: Miaohe Lin <linmiaohe@huawei.com>
>
>Use wrapper function wake_up_worker() to wake up first idle worker.
>
>Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
>---
> kernel/workqueue.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
>diff --git a/kernel/workqueue.c b/kernel/workqueue.c index c41c3c17b86a..5302f227f38f 100644
>--- a/kernel/workqueue.c
>+++ b/kernel/workqueue.c
>@@ -864,7 +864,7 @@ void wq_worker_running(struct task_struct *task)
>  */
> void wq_worker_sleeping(struct task_struct *task)  {
>-	struct worker *next, *worker = kthread_data(task);
>+	struct worker *worker = kthread_data(task);
> 	struct worker_pool *pool;
> 
> 	/*
>@@ -896,11 +896,9 @@ void wq_worker_sleeping(struct task_struct *task)
> 	 * lock is safe.
> 	 */
> 	if (atomic_dec_and_test(&pool->nr_running) &&
>-	    !list_empty(&pool->worklist)) {
>-		next = first_idle_worker(pool);
>-		if (next)
>-			wake_up_process(next->task);
>-	}
>+	    !list_empty(&pool->worklist))
>+		wake_up_worker(pool);
>+
> 	raw_spin_unlock_irq(&pool->lock);
> }
> 
>--
>2.19.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-04 18:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-27 12:29 [PATCH] workqueue: Use wake_up_worker() to wake up first idle worker linmiaohe
2020-08-03  7:48 ` Lai Jiangshan
2020-09-04 17:11 ` Tejun Heo
2020-08-24 12:00 linmiaohe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).