Re: [PATCH 4/5] workqueue: Automatically mark CPU-hogging work items CPU_INTENSIVE

From: Tejun Heo
Date: Mon Apr 24 2023 - 11:29:20 EST


Hello, Lai.

On Sun, Apr 23, 2023 at 11:23:28AM +0800, Lai Jiangshan wrote:
> wq_worker_stopping() and sched_submit_work() are only called from
> schedule() and are not called for other various kinds of scheduling,
> such as schedule_rtlock(), preempt_schedule_*(), __cond_resched().
>
> A work item hogging CPU may not call the bare schedule(). To make
> the new wq_worker_stopping() works, it has to be added to other kinds
> of scheduling, IMO.

Yeah, you're right. The proposed code would work fine only on !preempt
kernels. I guess the right thing to do is splitting out the hook for
non-sleeping schedulers and adding them in those paths. I'll look into it.

Thanks for spotting the issue.

--
tejun