From: Damien Le Moal <dlemoal@kernel.org>
To: Kyrylo Biryuk <illofspeed@gmail.com>, dm-devel@lists.linux.dev
Cc: mpatocka@redhat.com, snitzer@kernel.org, agk@redhat.com,
bmarzins@redhat.com, hare@kernel.org, hare@suse.de,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 1/2] dm zoned: back off when reclaim cannot make progress
Date: Wed, 4 Nov 2026 07:22:20 +0900 [thread overview]
Message-ID: <759f9072-02df-4862-a563-7d537bf4ea63@kernel.org> (raw)
In-Reply-To: <20261103220438.510609-2-illofspeed@gmail.com>
On 11/4/26 07:04, Kyrylo Biryuk wrote:
> When a reclaim pass cannot make progress, dmz_reclaim_work() still ends
> with dmz_schedule_reclaim(). If the target is idle, dmz_should_reclaim()
> keeps returning true, the work is queued again with no delay and the
> worker spins on the same failing pass. This patch handles two such
> cases:
>
> - dmz_do_reclaim() fails with -ENOSPC because no free zone is
> available to copy the data into, for example on a target without
> cache zones that has no free sequential zone left. The next patch
> also makes this the expected result when an idle target with cache
> zones has random zones but no free sequential zone.
> - dmz_do_reclaim() finds no zone it can lock for reclaim and returns
> -EBUSY. Since commit 90a9b8693f1b ("dm zoned: reclaim random zones
> when idle"), dmz_should_reclaim() returns true on an idle target
> whenever the total number of random (and cache) zones is non-zero,
> whether or not any of them holds data. Each pass then also runs
> dmz_check_dev(), which checks every device for media events (a TEST
> UNIT READY on SCSI disks).
>
> The -EBUSY loop lasts as long as the target stays idle; it ends when a
> pass finishes while the target is busy and has enough free zones. On
> three 27 TB host-managed SATA drives used as md RAID5 members (7.2.10
> with the module built out of tree, all random zones free, target idle
> for 300 seconds, kprobes attached, two other drives on the controller
> being zero-filled), each member's SCSI device counted about 108,000
> requests per second with the stock module and the system used about
> 915 s of CPU time, against about 46 s with this series. libata completes
> TEST UNIT READY in software, so these counters do not measure commands
> sent to the drives; the cost is CPU time.
>
> When a pass fails with -ENOSPC or -EBUSY, retrying at once is unlikely
> to make progress: re-arm the idle poll instead, so that reclaim is
> retried after DMZ_IDLE_PERIOD unless a zone allocation or a "reclaim"
> message queues it earlier. On a busy target, zone allocations can
> restart reclaim immediately when free space is low enough to require
> reclaim. Re-arming also keeps the poll running after a complete idle
> drain. The poll can still stop after a pass that ends while reclaim is
> not needed; that is unchanged.
>
> Skip the device check for these two results: they normally mean that
> there is no zone to copy into or no zone to reclaim, not that a device
> failed, and the I/O paths check the devices themselves. Use
> queue_delayed_work() so that work an allocation has already queued is
> not postponed.
>
> A pass that fails with an I/O error, for example on an unreadable block
> of a device that stays online, is still retried at once while the
> target is idle; this patch does not change that.
>
> Tested on 7.4-rc1 with this patch and the next one, on three emulated
> host-managed drives (scsi_debug, 1 GiB, 32 MiB zones) each under
> dm-zoned as md RAID5 members, all random zones free and the target idle
> for 300 seconds. With the stock module each member's SCSI device counted
> about 70.2 million requests and the reclaim workers used 726 s of CPU.
> With this series: 75 requests per member, 30 passes per worker (one per
> DMZ_IDLE_PERIOD) and 0.08 s of CPU. Data written during the tests read
> back with matching checksums, and no kernel warnings were logged.
>
> Fixes: 3b1a94c88b79 ("dm zoned: drive-managed zoned block device target")
> Fixes: 90a9b8693f1b ("dm zoned: reclaim random zones when idle")
> Cc: stable@vger.kernel.org
> Signed-off-by: Kyrylo Biryuk <illofspeed@gmail.com>
Looks good.
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2026-11-03 22:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 22:04 [PATCH v7 0/2] dm zoned: fix idle reclaim busy loops Kyrylo Biryuk
2026-11-03 22:04 ` [PATCH v7 1/2] dm zoned: back off when reclaim cannot make progress Kyrylo Biryuk
2026-11-03 22:22 ` Damien Le Moal [this message]
2026-11-03 22:04 ` [PATCH v7 2/2] dm zoned: do not reclaim a random zone into another random zone Kyrylo Biryuk
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=759f9072-02df-4862-a563-7d537bf4ea63@kernel.org \
--to=dlemoal@kernel.org \
--cc=agk@redhat.com \
--cc=bmarzins@redhat.com \
--cc=dm-devel@lists.linux.dev \
--cc=hare@kernel.org \
--cc=hare@suse.de \
--cc=illofspeed@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=snitzer@kernel.org \
/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®