mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: illofspeed <illofspeed@gmail.com>, dm-devel@lists.linux.dev
Cc: agk@redhat.com, snitzer@kernel.org, mpatocka@redhat.com,
	bmarzins@redhat.com, hare@suse.de, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] dm zoned: do not reclaim a random zone into another random zone
Date: Sun, 11 Oct 2026 16:30:01 +0200	[thread overview]
Message-ID: <d4adf5de-9d72-4977-b4c0-3e1f163872a1@kernel.org> (raw)
In-Reply-To: <20261010161613.396-3-illofspeed@gmail.com>

On 2026/10/10 18:16, illofspeed wrote:
> dmz_reclaim_rnd_data() falls back to a random destination zone when no
> free sequential zone is available and the target has cache zones. When
> the target is idle and the cache zone list is empty,
> dmz_get_rnd_zone_for_reclaim() selects random zones of the zoned device
> as well, so a random zone is then copied into another random zone. That
> frees nothing: the next pass picks the next random zone and copies it
> again, for as long as the target stays idle.
> 
> Seen on a two-device target (256 GiB regular cache device plus a 27 TB
> host-managed drive) used as an md RAID5 member: after a full rebuild
> every chunk was mapped and no sequential zone was free, and the idle
> drive read and wrote about 72 MB/s each without pause for hours while
> the free zone counters in "dmsetup status" did not change. Reproduced on
> emulated host-managed drives (tcmu-runner ZBC handler): 340 MB/s of
> copying on an idle target, 0 MB/s with this patch.
> 
> Only allow the random-zone fallback when the zone being reclaimed is a
> cache zone: moving it to the zoned device still frees cache space.
> 
> Fixes: c5c788595292 ("dm zoned: start reclaim with sequential zones")
> Assisted-by: LLM
> Signed-off-by: illofspeed <illofspeed@gmail.com>
> ---
>  drivers/md/dm-zoned-reclaim.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/md/dm-zoned-reclaim.c b/drivers/md/dm-zoned-reclaim.c
> index 315f0da99f3..2bcc163d209 100644
> --- a/drivers/md/dm-zoned-reclaim.c
> +++ b/drivers/md/dm-zoned-reclaim.c
> @@ -288,7 +288,14 @@ static int dmz_reclaim_rnd_data(struct dmz_reclaim *zrc, struct dm_zone *dzone)
>  again:
>  	szone = dmz_alloc_zone(zmd, zrc->dev_idx,
>  			       alloc_flags | DMZ_ALLOC_RECLAIM);
> -	if (!szone && alloc_flags == DMZ_ALLOC_SEQ && dmz_nr_cache_zones(zmd)) {
> +	/*
> +	 * Without a free sequential zone, moving a cache zone into a random
> +	 * zone of the zoned device still frees cache space. Moving a random
> +	 * zone into another random zone gains nothing, and when the target
> +	 * is idle it repeats forever. Only fall back for cache zones.

"fall back" to what? This comment is not clear.

> +	 */
> +	if (!szone && alloc_flags == DMZ_ALLOC_SEQ && dmz_nr_cache_zones(zmd) &&

Long line. Please split after "DMZ_ALLOC_SEQ &&".
Also, is the test for dmz_nr_cache_zones() needed? dmz_is_cache(dzone) will
never be true if there are no cache zones.

> +	    dmz_is_cache(dzone)) {
>  		alloc_flags = DMZ_ALLOC_RND;
>  		goto again;
>  	}


-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2026-10-11 14:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-10 16:16 [PATCH v2 0/3] dm zoned: fix two idle reclaim problems illofspeed
2026-10-10 16:16 ` [PATCH v2 1/3] dm zoned: back off when reclaim finds no destination zone illofspeed
2026-10-11 14:24   ` Damien Le Moal
2026-10-10 16:16 ` [PATCH v2 2/3] dm zoned: do not reclaim a random zone into another random zone illofspeed
2026-10-11 14:30   ` Damien Le Moal [this message]
2026-10-10 16:16 ` [PATCH v2 3/3] dm zoned: keep polling for idle reclaim after a reclaim pass illofspeed
2026-10-11 14:31   ` Damien Le Moal
2026-10-11 14:23 ` [PATCH v2 0/3] dm zoned: fix two idle reclaim problems Damien Le Moal
2026-10-11 14:33 ` Damien Le Moal

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=d4adf5de-9d72-4977-b4c0-3e1f163872a1@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=agk@redhat.com \
    --cc=bmarzins@redhat.com \
    --cc=dm-devel@lists.linux.dev \
    --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®