[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aSC34j_aaW9YOzmZ@slm.duckdns.org>
Date: Fri, 21 Nov 2025 09:05:06 -1000
From: Tejun Heo <tj@...nel.org>
To: Lai Jiangshan <jiangshanlai@...il.com>
Cc: linux-kernel@...r.kernel.org, ying chen <yc1082463@...il.com>,
Lai Jiangshan <jiangshan.ljs@...group.com>
Subject: Re: [PATCH V3 5/7] workqueue: Process rescuer work items one-by-one
using a cursor
> static bool assign_rescuer_work(struct pool_workqueue *pwq, struct worker *rescuer)
> {
> struct worker_pool *pool = pwq->pool;
> + struct work_struct *cursor = &pwq->mayday_cursor;
> struct work_struct *work, *n;
>
> + /* from where to search */
maybe: search from the start or cursor if available
...
> + /* try to assign a work to rescue */
maybe: find the next work item to rescue
> + list_for_each_entry_safe_from(work, n, &pool->worklist, entry) {
> + if (get_work_pwq(work) == pwq && assign_work(work, rescuer, &n)) {
> pwq->stats[PWQ_STAT_RESCUED]++;
> + /* put the cursor for next search */
> + list_add_tail(&cursor->entry, &n->entry);
> + return true;
> + }
...
> @@ -5141,6 +5169,20 @@ static void init_pwq(struct pool_workqueue *pwq, struct workqueue_struct *wq,
> INIT_LIST_HEAD(&pwq->pwqs_node);
> INIT_LIST_HEAD(&pwq->mayday_node);
> kthread_init_work(&pwq->release_work, pwq_release_workfn);
> +
> + /*
> + * Set the dumpy cursor work with valid function and get_work_pwq().
^
dummy
> + *
> + * The cursor work should only be in the pwq->pool->worklist, and
> + * should never be queued, processed, flushed, cancelled or even examed
^
examined
I wonder whether this is unnecessarily verbose. Maybe just "should not be
treated as a regular work item"?
Thanks.
--
tejun
Powered by blists - more mailing lists