lkml.org 
[lkml]   [2023]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] workqueue: Fix warning triggered when nr_running is checked in worker_enter_idle()
On Tue, May 23, 2023 at 10:09:41PM +0800, Zqiang wrote:
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index 9c5c1cfa478f..329b84c42062 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -1144,13 +1144,12 @@ void wq_worker_tick(struct task_struct *task)
> * longer than wq_cpu_intensive_thresh_us, it's automatically marked
> * CPU_INTENSIVE to avoid stalling other concurrency-managed work items.
> */
> - if ((worker->flags & WORKER_NOT_RUNNING) ||
> + if ((worker->flags & WORKER_NOT_RUNNING) || worker->sleeping ||
> worker->task->se.sum_exec_runtime - worker->current_at <
> wq_cpu_intensive_thresh_us * NSEC_PER_USEC)
> return;

Ah, right, this isn't just interrupted read-modify-write. It has to consider
sleeping. This is subtle. We'll definitely need more comments. Will think
more about it.

Thanks.

--
tejun

\
 
 \ /
  Last update: 2023-05-23 21:41    [W:0.060 / U:0.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site