[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAN2Y7hzDZxt5tBPeqwKwNNwwGXgmhj_uYDMkxx5_QtoqV97v1A@mail.gmail.com>
Date: Thu, 13 Nov 2025 10:34:43 +0800
From: ying chen <yc1082463@...il.com>
To: Tejun Heo <tj@...nel.org>
Cc: corbet@....net, jiangshanlai@...il.com, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, laoar.shao@...il.com
Subject: Re: [PATCH] workqueue: add workqueue.mayday_initial_timeout
On Thu, Nov 13, 2025 at 12:03 AM Tejun Heo <tj@...nel.org> wrote:
>
> Hello,
>
> On Wed, Nov 12, 2025 at 10:01:10AM +0800, ying chen wrote:
> > Works that have already been scheduled will be executed sequentially
> > within the rescuer thread.
> > static int rescuer_thread(void *__rescuer)
> > {
> > ......
> > /*
> > * Slurp in all works issued via this workqueue and
> > * process'em.
> > */
> > WARN_ON_ONCE(!list_empty(scheduled));
> > list_for_each_entry_safe(work, n, &pool->worklist, entry) {
> > if (get_work_pwq(work) == pwq) {
> > if (first)
> > pool->watchdog_ts = jiffies;
> > move_linked_works(work, scheduled, &n);
> > }
> > first = false;
> > }
> >
> > if (!list_empty(scheduled)) {
> > process_scheduled_works(rescuer);
> > ......
> > }
>
> Ah, I see what you mean. The slurping is to avoid potentially O(N^2)
> scanning but that probably the wrong trade-off to make here. I think the
> right solution is making it break out after finding the first matching work
> item and loop outside so that it processes work item one by one.
Processing work items one-by-one is indeed an excellent solution.
However, wouldn't it also be necessary to provide a method for
adjusting the mayday initial timeout?
Thanks.
Powered by blists - more mailing lists