Re: [RFC PATCH V5 5/5] workqueue: introduce a way to set workqueue's scheduler
From: Lai Jiangshan
Date: Mon Jan 29 2018 - 01:33:49 EST
On Mon, Jan 29, 2018 at 12:41 PM, Mike Galbraith <efault@xxxxxx> wrote:
> On Mon, 2018-01-29 at 12:15 +0800, Lai Jiangshan wrote:
>> I think adding priority boost to workqueue(flush_work()) is the best
>> way to fix the problem.
>
> I disagree, priority boosting is needlessly invasive, takes control out
> of user hands. The kernel wanting to run a workqueue does not justify
> perturbing the user's critical task.
The kworkers doesn't belong to any user, it is really needlessly invasive
if we give the ability to any user to control the priority of the kworkers.
If the user's critical task calls flush_work(). the critical task should
boost one responsible kworker. (the kwoker scheduled for
the work item, or the first idle kworker or the manager kworker,
the kwoker for the later two cases is changing, need to migrate
the boosting to a new kworker when needed)
The boosted work items need to be moved to a prio list in the pool
too for the boosted kworker to pick it up.
>
> I think "give userspace rope" is always the best option, how rope is
> used is none of our business. Giving the user a means to draw a simple
> line in the sand, above which they run only critical stuff, below
> which, they can do whatever they want, sane in our opinions or not,
> lets users do whatever craziness they want/need to do, and puts the
> responsibility for consequences squarely on the right set of shoulders.
>
> -Mike