Re: [PATCH 9/9] workqueue: Implement system-wide nr_active enforcement for unbound workqueues

From: Lai Jiangshan
Date: Tue Jan 23 2024 - 21:58:06 EST


Hello, Tejun

On Wed, Jan 24, 2024 at 8:30 AM Tejun Heo <tj@xxxxxxxxxx> wrote:

> > > /**
> > > * pwq_activate_first_inactive - Activate the first inactive work item on a pwq
> > > * @pwq: pool_workqueue of interest
> > > + * @fill: max_active may have increased, try to increase concurrency level
> >
> > I think it is also legitimate to increase the concurrency level ASAP
> > when called from try_to_grab_pending() path.
>
> Can you elaborate why that'd be useful?
>

If an active item for a PWQ is canceled, the PWQ will lose a hard-earned
nr_active and have to wait on the round-robbin queue for another nr_active.

It seems it is unfair for this PWQ. If a user's program pattern is
queuing-checking-cancelling items, it can cause delays for other users
sharing the same workqueue.

Thanks
Lai