From: Tejun Heo <tj@kernel.org>
To: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: linux-kernel@vger.kernel.org,
Lai Jiangshan <jiangshan.ljs@antgroup.com>,
ying chen <yc1082463@gmail.com>
Subject: Re: [PATCH] workqueue: Process rescuer work items one-by-one using a positional marker
Date: Thu, 13 Nov 2025 07:15:43 -1000 [thread overview]
Message-ID: <aRYSPyIp2LYzUkf-@slm.duckdns.org> (raw)
In-Reply-To: <20251113163426.2950-1-jiangshanlai@gmail.com>
Hello, Lai.
On Fri, Nov 14, 2025 at 12:34:26AM +0800, Lai Jiangshan wrote:
> +static void insert_mayday_pos(struct pool_workqueue *pwq, struct work_struct *next)
> +{
> + unsigned int work_flags;
> + unsigned int work_color;
> +
> + __set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(&pwq->mayday_pos_work));
Maybe use test_and_set_bit() here like normal work item?
> +static void remove_mayday_pos(struct pool_workqueue *pwq)
> +{
> + list_del_init(&pwq->mayday_pos_work.entry);
> + pwq_dec_nr_in_flight(pwq, *work_data_bits(&pwq->mayday_pos_work));
> + INIT_WORK(&pwq->mayday_pos_work, mayday_pos_func);
and maybe we can init the work item once and
> static void send_mayday(struct work_struct *work)
> {
> struct pool_workqueue *pwq = get_work_pwq(work);
> @@ -2992,6 +3037,9 @@ static void send_mayday(struct work_struct *work)
> if (!wq->rescuer)
> return;
>
> + if (!work_pending(&pwq->mayday_pos_work))
drop this conditional too?
Also, I wonder whether it'd be simpler to think about if we just exclude the
work item from flush color management. e.g. we can just flag the work item
and then make work scanning skip them, so that they really are just markers;
then, we don't have to worry about colors or othre states at all. We just
insert the marker and use it purely as iteration marker.
> + /* reset the position and handle the assigned work */
> + if (list_next_entry(&pwq->mayday_pos_work, entry) != n) {
> + remove_mayday_pos(pwq);
> + insert_mayday_pos(pwq, n);
and this would become simple list_move_tail().
Thanks.
--
tejun
next prev parent reply other threads:[~2025-11-13 17:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-13 16:34 Lai Jiangshan
2025-11-13 16:52 ` Lai Jiangshan
2025-11-13 17:15 ` Tejun Heo [this message]
2025-11-14 2:41 ` Lai Jiangshan
2025-11-14 13:31 ` Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aRYSPyIp2LYzUkf-@slm.duckdns.org \
--to=tj@kernel.org \
--cc=jiangshan.ljs@antgroup.com \
--cc=jiangshanlai@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=yc1082463@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®