Re: [PATCH] workqueue: Control the frequency of intensive warning through cmdline

Xuewen Yan
2024-02-21T11:01:07Z

Hi Tejun

On Wed, Feb 21, 2024 at 1:44 PM Tejun Heo <tj@kernel.org> wrote:
>
> Hello,
>
> On Wed, Feb 21, 2024 at 10:01:17AM +0800, Xuewen Yan wrote:
> > cnt = atomic64_inc_return_relaxed(&ent->cnt);
> > - if (cnt >= 4 && is_power_of_2(cnt))
> > + if (cnt == wq_cpu_intensive_warning_nth ||
> > + (cnt > wq_cpu_intensive_warning_nth && is_power_of_2(cnt)))
>
> If we do this the nth name doesn't really make sense. Maybe something like
> wq_cpu_intensive_warning_thresh is better? Also, something like the
> following might be more predictable. Let's say
> wq_cpu_intensive_warning_thresh of 0 disables the warnings and it's
> initialized to 4 by default.
>
> if (cnt >= wq_cpu_intensive_warning_thresh &&
> is_power_of_2(cnt + 1 - wq_cpu_intensive_warning_thresh))
>

This way looks simpler, but it could not disable the warnings, but I
think this is okay, because even if the threshold is set to 0, the
warning will only be printed when 1, 3, 7, 15....

I will send patch-v2 later as you suggested:)

Thanks.
BR

--
xuewen