Re: [PATCHSET wq/for-6.8] workqueue: Implement system-wide max_active for unbound workqueues

From: Tejun Heo
Date: Fri Dec 22 2023 - 04:08:16 EST


Hello,

On Fri, Dec 22, 2023 at 04:04:27PM +0800, Lai Jiangshan wrote:
> The current "max_active enforcement domain" is just a historical accident.

I mean, the part that it's bound to NUMA is accidental but the fact that we
need an enforcement domain which is closer to the whole machine isn't. Most
users don't depend on max_active limit but there are a number of users that
do and what they usually want to express is "I want to be able to saturate
the whole machine but avoid creating pointless over-saturation", which
usually comes down to some multiples of the number of CPUs.

Note that there may be a single issuer or multiple issuers and we want to be
able to saturate the machine while avoding over-saturation in both cases. If
we segment max_limit enforcement to smaller units like CPUs or L3 caches,
there's no good way to express these constraints. A number which is too
smaller for single issuer case is already too big for multiple issuer case.

I tried to explain the conundrum in the cover letter but if that's not
sufficient, we can keep discussing. It'd be also useful to read what Naohiro
reported as that shows the problem pretty well.

> IMO, it is better to change the semantics of max_active and the related
> alloc_workqueue() callers rather than add a large bulk of complicated
> code. Most of alloc_workqueue() are called with max_active=0, so it is
> feasible.

Yeah, I mean, if we can, that'd be simpler. I don't think we can. It's a
rather fundamental problem. If you have concrete suggestions, please feel
free to share.

Thanks.

--
tejun