[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y91gqnkZM67x76WC@slm.duckdns.org>
Date: Fri, 3 Feb 2023 09:29:46 -1000
From: Tejun Heo <tj@...nel.org>
To: Petr Mladek <pmladek@...e.com>
Cc: Lai Jiangshan <jiangshanlai@...il.com>,
Michal Koutny <mkoutny@...e.com>, linux-kernel@...r.kernel.org
Subject: Re: [RFC 2/5] workqueue: Warn when a new worker could not be created
On Fri, Feb 03, 2023 at 03:10:28PM +0100, Petr Mladek wrote:
> A solution would be to use a custom printk_ratelimited_wq() that would
> allow printing one message per 2 * wq_watchdog_thresh.
> Something like:
>
> #define printk_ratelimited_wq(fmt, ...) \
> ({ \
> static DEFINE_RATELIMIT_STATE(_rs, 60 * HZ, 1); \
> \
> if (__ratelimit(&_rs)) \
> printk(fmt, ##__VA_ARGS__); \
> })
>
> I admit that it is much easier than __print_create_worker_failure().
>
> The only problem might be that wq_watchdog_thresh might be modified
> at runtime. But it can be solved by sharing the same
> struct ratelimit_state rs in all printk_ratelimited_wq() calls
> and updating it together with wq_watchdog_thresh.
>
> Would you prefer the custom printk_ratelimited_wq(), please?
Yeah, I think so.
Thanks.
--
tejun
Powered by blists - more mailing lists