lkml.org 
[lkml]   [2023]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2023-03-27 00:09    [W:0.042 / U:0.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site