From: Tao Cui <cui.tao@linux.dev>
To: Bart Van Assche <bvanassche@acm.org>, axboe@kernel.dk
Cc: cui.tao@linux.dev, hch@lst.de,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
cuitao@kylinos.cn, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org,
Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Subject: Re: [PATCH v10] loop: defer the queue limits clear to a workqueue
Date: Fri, 4 Dec 2026 17:58:55 +0800 [thread overview]
Message-ID: <dc6eeb74-5cb4-41a5-8aaa-9f48a203bc36@linux.dev> (raw)
In-Reply-To: <aa704a7a-32b3-4f7d-a18b-55a4966a727e@acm.org>
Hello, Bart,
在 2026/12/4 1:18, Bart Van Assche 写道:
>
> On 12/3/26 12:16 AM, Tao Cui wrote:
>> + lo->clear_wq = alloc_workqueue("loopc%d",
>> + WQ_UNBOUND | WQ_MEM_RECLAIM,
>> + 0, lo->lo_number);
>
> WQ_MEM_RECLAIM creates a rescuer thread per loop device. Is that flag
> really needed? Additionally, has it been considered to use a single
> workqueue for all loop devices?
Agreed on the flag: v11 drops it, loop%d, which runs the request path
itself, does not use WQ_MEM_RECLAIM either.
On a single workqueue for all devices: I'd rather not, if you're OK
with that. The work function reads the loop_device, and the
per-device queue is what keeps that safe, since lo_free_disk() destroys
it before the loop_device is freed. A shared queue cannot be destroyed
at teardown, so the work item would have to carry a new reference on
the loop device. loop%d is per device already, so I'd keep this shape
unless you prefer the shared queue.
>
>> + if (!file)
>> + return false;
>
> lo_fallocate() has already dereferenced 'file', so this can't happen.
>
Agreed, will remove.
>> + if (!queue_work(lo->clear_wq, &w->clear_limits_work)) {
>
> queue_work() cannot fail for a work item that has just been
> initialized. Please remove this error path.
>
Agreed, will remove.
>> + if (loop_clear_limits(lo, file, mode) &&
>> + test_and_set_bit(0, &lo->clear_limits_reported))
>> + rq->rq_flags |= RQF_QUIET;
>
> Please move the RQF_QUIET changes into a separate patch since these are
> not needed to fix the race.
Sure, I'll post it as 2/2 of a two-patch series. The marking is what
keeps loop/011 at exactly one dmesg error per binding: without it,
concurrent failures can all report before the first clear commits
(this is how blktests CI failed loop/011 back on v6).
>
>> + if (lo->clear_wq)
>> + destroy_workqueue(lo->clear_wq);
>> if (lo->workqueue)
>> destroy_workqueue(lo->workqueue);
>
> Work queued on lo->workqueue queues work on clear_wq, so please destroy
> lo->workqueue first.
>
Agreed, will swap the order.
Thanks,
Tao.
> Thanks,
>
> Bart.
prev parent reply other threads:[~2026-12-04 9:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 5:42 [PATCH v8] loop: defer the queue limits clear to a workqueue Tao Cui
2026-11-26 10:06 ` Tao Cui
2026-11-26 13:56 ` [PATCH v9] " Tao Cui
2026-11-26 15:32 ` Bart Van Assche
2026-11-30 10:20 ` Tao Cui
2026-11-30 14:04 ` Bart Van Assche
2026-11-30 14:57 ` Tao Cui
2026-11-30 16:34 ` Bart Van Assche
2026-12-01 13:14 ` Tao Cui
2026-12-02 15:13 ` Bart Van Assche
2026-12-03 8:08 ` Tao Cui
2026-12-03 8:16 ` [PATCH v10] " Tao Cui
2026-12-03 17:18 ` Bart Van Assche
2026-12-04 9:58 ` Tao Cui [this message]
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=dc6eeb74-5cb4-41a5-8aaa-9f48a203bc36@linux.dev \
--to=cui.tao@linux.dev \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=cuitao@kylinos.cn \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=shinichiro.kawasaki@wdc.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