From nobody Sun Oct 25 14:54:06 2026 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 482A34F68C9 for ; Tue, 13 Oct 2026 12:39:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791895188; cv=none; b=D318+xavVX/TA2BIbncsTVByooGpcsCojoi8R65++tSteo+bA5sCIFYUks0Glilw19C2a4CE4ELxdKv5J9iPEa6CGFpwm50FpizEUHc909REFLHTJhhfymxOoj+xCwQP560eV9I5yvdZpssjB6QXoAfDWztXsWYxaBItvC9/k/8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791895188; c=relaxed/simple; bh=sA+c0WYN2bPE37DjivosiMzZqIXScnG8RZ8vm73mDVM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kbgSW1YHQ2y4eByj7uY0IM9ev49fHj19fGiJJ3BHtTRmmTzuFydboz/zTjsEmLf+btwa2HAhMpzOLn+000jot1pe/V+PlJP0D1K+L/W21kge//1En8qUMcPIu54QBRTG1/7o3l1TFXuntmvgE6gbwF1xg2X5xrOOwe7bFsxXlQI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lxmvhIrJ; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lxmvhIrJ" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-48b02b1b4cfso3169700f8f.0 for ; Tue, 13 Oct 2026 05:39:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1791895185; x=1792499985; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=2TF+nw/u3d0JmPL6ecEUe1KLmlN203omllzFb/e1Krk=; b=lxmvhIrJNoJFKIc7BjnrH1V68VSBcY8TNEafUctMZw3Kvx1P5K+DvrsZasHJ33rPEL /oE8EowRUMsU2bg/N9DwpPudTtzRfXj1QRsH72xx8lBS2W8gNLam4syg99q/NJ7F4vGq a/f00JgfVZJ9rCs9GsRpXzmyJ8zJBwsYUfkKKHGm8T9/eZFZ5NVLjwdaGphcqdK2E25t 5rTUl8ssEv8IPK6KMCSwVwU260mFhnPTko8XyRbPmfn7Uau2Z0mllVEy8OqvlpXYa7bA /63l0w/yi6E2M+HqiLKnhF1XvaEEmn7Dqs1AHhpql4XIyS03Rssk+twq3B2HB+x1MWC8 Dv+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791895185; x=1792499985; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=2TF+nw/u3d0JmPL6ecEUe1KLmlN203omllzFb/e1Krk=; b=pgrlnv9yDhmLQ4rPTCpx0Qbwrwbc7/UVwJV6JnGzgp9BSL4eza6zWH/CnN4dAoxPfm L/aSsbulS7qo0ltezk+Vt863oljMrAlydiOSPtYB0c7S0YKKYjTKQzVKjmbKxkAd0riF 8aZljEKuxsfzM/U8GZ6gIaXRfiLTkcJCVhYSiqko18mTZyjQGPNHCnR3cJfWr1XzIn2O J06cwFaN+d63YqSFeU4Hz8J1t8tgENikcJWNI4yLqu0j/LrcDXMzxt9iSP+pf08+/ycn msdgcVvR6T5RfeFKIlfKne6ADr4hpTZCxLYbHyWtkFgeXLU+PP6YFz8nwmmJ+bYKNIED VnYA== X-Forwarded-Encrypted: i=1; AKwUvBzVgEqUIMW4cvMu0cyQzF6ecnBrs+i93LrvaFT49Ca1zINFtzZF6ajy+3bVPX8ajNvNkht4HGD3b+F8vl4=@vger.kernel.org X-Gm-Message-State: AFq9FYI3cmPd9rJW7p8/T4g1qIOj0asAo1uqQ+9/yoV305Kt1+J6NexW h24DniWe7MaF1xJnY8jzek5WGczaK7iCWNaS5PtBmyAMJ977/q276ysX X-Gm-Gg: AYBFou1hYkgembQ4gPAvOXRY7hiKdQ2a/OBzck8qS73+kcxU1tEL0ZjTKMxDqrLHkM1 iaXEkKw9UJ5h4bn0VIBPAKl6Zvyh1glrS3qivSgS/NiOv/7zXLh7Cs9ONz7YzIYAHz98ACcu/QE BCnSeiFCrinZg/RG3/hYyTKTqdZc/4lz5YnJ+8ZV7FPowF3/to4t2hkIBTj3Klp+j2BneMqKuh0 rMlO5XVB+aEpQyMPlKsl1Sh47uUEhXWp5zvBGrGYLyqjBSl28qXOmyWQfU/8llUr9yvvI9IOaCf bgRviyCmoAEOicqkp9oc6hQofNrz613QF7oCUxazkQdwoV8w2N0ICE17d/XAPrahMPNhFE8pJqy 2EJ/ZXAnu4hhO1rbHpvn8uo2kJXyNV0iH/g5OwkOmA9kD1V9Wu14Hp2kMfWZ48PvCxil88Q4hg1 uV89vwSCrFnadNpXwJg9BFLbfYX3I12LqW/QSAFA19LPxLRIiUPQ220nUfRXv57K9dRboxvsBNp AMXGahy4YIeidVEwg6yGy9jbK8nwWNIZGElUqqFZjM0VZc= X-Received: by 2002:a05:6000:188a:b0:48c:72fc:3644 with SMTP id ffacd0b85a97d-48dbacf555bmr28162303f8f.22.1791895185415; Tue, 13 Oct 2026 05:39:45 -0700 (PDT) Received: from localhost.localdomain (87-205-122-125.dynamic.inetia.pl. [87.205.122.125]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48de0bc7299sm4179440f8f.53.2026.10.13.05.39.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Oct 2026 05:39:45 -0700 (PDT) From: Kyrylo Biryuk To: dm-devel@lists.linux.dev Cc: mpatocka@redhat.com, snitzer@kernel.org, agk@redhat.com, bmarzins@redhat.com, dlemoal@kernel.org, hare@suse.de, linux-kernel@vger.kernel.org Subject: [PATCH v4 1/3] dm zoned: back off when reclaim finds no destination zone Date: Tue, 13 Oct 2026 14:39:38 +0200 Message-ID: <20261013123940.952-2-illofspeed@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261013123940.952-1-illofspeed@gmail.com> References: <20261013123940.952-1-illofspeed@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When dmz_do_reclaim() fails with -ENOSPC because no free zone is available to copy the data into, 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. Re-arm the idle poll instead, so that reclaim is retried after DMZ_IDLE_PERIOD. The next patch makes -ENOSPC the expected result when an idle target has random zones but no free sequential zone. Tested on 7.3-rc7 together with the next two patches, on emulated host-managed drives (scsi_debug zbc=3Dmanaged, and the tcmu-runner ZBC handler under md RAID5). Earlier versions of the series ran on 7.2.6 on three 27 TB host-managed drives used as md RAID5 members. Fixes: 3b1a94c88b79 ("dm zoned: drive-managed zoned block device target") Reviewed-by: Hannes Reinecke Reviewed-by: Damien Le Moal Assisted-by: LLM Signed-off-by: Kyrylo Biryuk --- drivers/md/dm-zoned-reclaim.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/md/dm-zoned-reclaim.c b/drivers/md/dm-zoned-reclaim.c index c041413c729..315f0da99f3 100644 --- a/drivers/md/dm-zoned-reclaim.c +++ b/drivers/md/dm-zoned-reclaim.c @@ -540,6 +540,14 @@ static void dmz_reclaim_work(struct work_struct *work) if (ret && ret !=3D -EINTR) { if (!dmz_check_dev(zmd)) return; + if (ret =3D=3D -ENOSPC) { + /* + * No zone to copy into: nothing can progress now. + * Rescheduling immediately would spin; poll instead. + */ + mod_delayed_work(zrc->wq, &zrc->work, DMZ_IDLE_PERIOD); + return; + } } =20 dmz_schedule_reclaim(zrc); --=20 2.43.0 From nobody Sun Oct 25 14:54:06 2026 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4AAEE4F7975 for ; Tue, 13 Oct 2026 12:39:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791895189; cv=none; b=YUFpN1P/sgqBd8HJYtOLnl8Jb12HbQggN/3lbnDQJ7yh1QJxRUfcaM7EPD33yJO1ri5ftromMAXfDJq/MP8bnfnxPK/9V36DWCVrS57MbNgPvs0vQkL0p9RgOiOINvBtPzXA32XqC3qx+PVDaktVfIrgcf5KzewoDdImrCjiACI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791895189; c=relaxed/simple; bh=o+oFNcLpuYqRZRBrDMdI0bemVABEvrdGdfb8nMKpYCA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G4gERWjxvBb5HMvvRY7CIv6RPqHhQfq2/Yoell+LBdMso3i5qqfTjT06As3FRCoSC9f9EGqXw5xqDSvCRmPI2K7CISULOrr7R24wN7EKC1VoQdOLDxmEU2VqcsdsKNw4HxC/oqqTvPMWZ3phYQ+gD2R9Rk6A+g+BsH8emubq2Do= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GdvWsrjL; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GdvWsrjL" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4a1af482519so4175025e9.1 for ; Tue, 13 Oct 2026 05:39:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1791895186; x=1792499986; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=tAWkYGdqvifr12JtKIaB4bUGFJ5gXXZ5L73FeOEQvOQ=; b=GdvWsrjLWcMiP9fZ1ahbbhArefyTeYu9wHC4qBHFlI1TFSVlJXkI/e7FPCsGSDPeMk Y1hGqca4m4MSFuVWz7ayVsis9bZJuZnTNbGWJEgAC8/S/h8GOWc3IZ/tUeARwSaA9Wjc nSDFdXnuJZh5KvajnIbqUhh6hYAG7TO/0ro0lyraw/HyitmmybR9NDFdkiaUI7mshiYm ttAoD0aKev82a8RP0RE7iR5TAP7HxCJJEMYkQHoCtx1CKGrR7oNZufRmVPGNA2g4HwJh HGGD94ED9ROUCtre8ZhZF+OgfWQunGZxysNIWJ7Qr29P3CFKBYK6VfND5d4xlavuneJg laHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791895186; x=1792499986; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=tAWkYGdqvifr12JtKIaB4bUGFJ5gXXZ5L73FeOEQvOQ=; b=FqeAzyQv1iiKLRMNIMjn+a5qKbklvnlKWCW9amBtPeGjHIm20F3zErwphDFAp3Oarh 55tt3Eylnzs12yC2eoe6fhU8Xy0D8gJ4/C3uEEmlhuYErPKsv/h9pxCo6EXUUKhi6ntu /tc5gk9UMBOfyzXFxyeYQHSOxnAPmTjNZwsDZWOgsH+qP4ghpimBlvsBLGze360ik1Tj 4h6B6XP71MMjSrZJ7H3LFMohUYdALHirG3SHaeN+VpbK96/Mxsov0rAjYCM+PqwRF2MH wd791HmTGkK+nndJmV3o89MMNBvnwWkN/eHqGpu3u5eWXL9Dolxfzandu0shqo5B3/fc HUzQ== X-Forwarded-Encrypted: i=1; AKwUvBwJFAIGadgQvzS1E7EboBqIqaNKGDW2nzrrpC6rrjcqGuids2m9ncp0TKXFzkwbR7p/QVARwTuWD4JvmKo=@vger.kernel.org X-Gm-Message-State: AFq9FYL45Mv0ayJ8csHt442ettlRhb/zoJb02hFuhJmpRNvur2t+Cmaj U4R5dfabe20Z+cvJdH+Z2cIdJMoLNayUK3Jffx8hw0orEmJG6Csl4B4l X-Gm-Gg: AYBFou1SH5azNwGTGxCC2Kn6Pq/pIfDjweiWb5hswPT20DicZ6yIQPom5gUYwACJHvT JnS31JXbRNqSwVOJ/1ZcbFNIqnNW9VILE+xQlzSvIXyE3r/NdsoMhvMlsUFw9TTUTgCNmuIRCfB kMD46cDwpJ+oQ9m/8ZQ2yejm5qmdyP/SeWtwWgqPqjIzSiwcFqXHQ4EiT9os0anUYlnSMRHMNUG R4UsVbVc+H40vdzAlfu4OiTU3Xxse60tvEZUSD7qIUyivHHViSjoLNcncKPdzWsbollO6iiWED6 Hmu3DJc3QOz6o7Klb4mpBtMmAe0sxdJad5dqsIIugYrhnXWm2wcIVWi9qzXpN+WJcb5yLEZdThP n56HnkG79kC31zhFDralbZSuJhMW72wpNc4+aPfzY8Cnr83D+1kav78yoUE/SWZ85W9CLH08B4A HGirSMZD8XclTXmc2OfGDWV33OXHpYHLBuwk6W1L2JVaZU9ZWh7zHsX4FJPM9EScD9kaKFkJsXy v98TpN8sl5XMg374U8GTqPOVO+W8SkgFBdcNOHiRkS9D3vs7y1/Wwb8bg== X-Received: by 2002:a05:600d:864c:10b0:4a1:8bff:9284 with SMTP id 5b1f17b1804b1-4a18dcd532cmr193416285e9.15.1791895186426; Tue, 13 Oct 2026 05:39:46 -0700 (PDT) Received: from localhost.localdomain (87-205-122-125.dynamic.inetia.pl. [87.205.122.125]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48de0bc7299sm4179440f8f.53.2026.10.13.05.39.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Oct 2026 05:39:46 -0700 (PDT) From: Kyrylo Biryuk To: dm-devel@lists.linux.dev Cc: mpatocka@redhat.com, snitzer@kernel.org, agk@redhat.com, bmarzins@redhat.com, dlemoal@kernel.org, hare@suse.de, linux-kernel@vger.kernel.org Subject: [PATCH v4 2/3] dm zoned: do not reclaim a random zone into another random zone Date: Tue, 13 Oct 2026 14:39:39 +0200 Message-ID: <20261013123940.952-3-illofspeed@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261013123940.952-1-illofspeed@gmail.com> References: <20261013123940.952-1-illofspeed@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 switch to a random destination zone 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") Reviewed-by: Damien Le Moal Assisted-by: LLM Signed-off-by: Kyrylo Biryuk --- drivers/md/dm-zoned-reclaim.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-zoned-reclaim.c b/drivers/md/dm-zoned-reclaim.c index 315f0da99f3..88d56d3c86d 100644 --- a/drivers/md/dm-zoned-reclaim.c +++ b/drivers/md/dm-zoned-reclaim.c @@ -288,7 +288,13 @@ static int dmz_reclaim_rnd_data(struct dmz_reclaim *zr= c, struct dm_zone *dzone) again: szone =3D dmz_alloc_zone(zmd, zrc->dev_idx, alloc_flags | DMZ_ALLOC_RECLAIM); - if (!szone && alloc_flags =3D=3D DMZ_ALLOC_SEQ && dmz_nr_cache_zones(zmd)= ) { + /* + * If no free sequential zone is available, a cache zone can still be + * moved into a free random zone of the zoned device, which frees cache + * space. Do not do this for a random zone: moving it into another + * random zone frees nothing and, on an idle target, repeats forever. + */ + if (!szone && alloc_flags =3D=3D DMZ_ALLOC_SEQ && dmz_is_cache(dzone)) { alloc_flags =3D DMZ_ALLOC_RND; goto again; } --=20 2.43.0 From nobody Sun Oct 25 14:54:06 2026 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 621A94F7CC9 for ; Tue, 13 Oct 2026 12:39:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791895191; cv=none; b=qOQ6w6Wt09w2PYtIhlLqFw4n76EdpK1AItJ9MtjMYQ1k8FQHCbKuXbgrVWDYHOaONqEqX1zGZ5RaTaSq3mePkxRhFnbBfPDNdRzlbuaTY53kbNCb6ZccwVwykBFlttlqkB4atwEdspN3inlkvaDXDq8rkwQBaSie8a0FNdg6CFg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791895191; c=relaxed/simple; bh=q7IP0n0tFVgXui57e7ZoWvGl6mJaR5f8ZscXMkb5tZc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rEeQnQQTy4l6AIk/RdAod3zwK9kpVWDjxO0AM58K7leQ00VDu8uw0OcX3VHBujQUuownU6/I39R6zAvXRNTS1RW3C/pgHdJp1fsPLmsd/FbB5jMozhrq/d181niSbc8v8FNrdDLaUC0A2BTKe2C67U/115snVHV2f07wOnIRDsk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ONV2LTXd; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ONV2LTXd" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4a1635f7c89so29387495e9.2 for ; Tue, 13 Oct 2026 05:39:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1791895188; x=1792499988; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=/ngQKRroXU/Uz8Mh7Lut0ld0a0rsmTuRWomcPoA8M0I=; b=ONV2LTXdrdsgtJb3ZcPs9Nu/d8IhlpIMwRn1hTsgXWhThM41PVVV+t+ALS0eCY7Db2 gLaNwXcKJ8NXLX6Qir1uvZcdNMVzGNEHBklh8u0qML9DjQqpRf3qMArnLH71u/dMOYFR kb8rFtFkIH7taAWxjlXnvni+FGHRYZkn4jdBP9NVty/bjjkfAIIhj63bu+quS7Xl0DmB SHk1Xf1O6kgDtKkBKXfDxkySNvRE3/X5RBBex0BNhk/LZCo9esOn9+cKEo707V954YLl dZKhBnZgYl/HVCB9maWwEWXlPxnuXxNzRzdstwRo5CmC5LUrTXmj2sNvs8HaJAdU8RHm Lxaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791895188; x=1792499988; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=/ngQKRroXU/Uz8Mh7Lut0ld0a0rsmTuRWomcPoA8M0I=; b=Ovx6Tr3bgimpmJzLyrtkbt6WgxKjvwvpXQeoYIViJoK8V47zH8pcDMq8OOmNcxIMXm IfXTpc70vQXAlkXtl5Tcz3/TSRkjYhL7BR8oEJY9Ui3OoJst9ELbPVBlUo8f5tEzhfGQ ZhqlIGJlg/8fTLrRk3eCB5uJ+FfRPHtnG9/5cECtnWkfct94Qqcs3T+8XCe+hKZs0iXx 6AIENqto8u3V8ZdLCB0M6UOV5GcrhnZz7jgHW2g/vpLtonlmUS4/yXOYNZOldQhw/LC0 EtwzpbkEfH1Ul1Qqd2RcFKjx1hWlS4zOZhoFyDg8asEvSxwdlv9q19O/jydp9Wq/OfMT 9iYg== X-Forwarded-Encrypted: i=1; AKwUvBxJAFg7Pfich3uc/bUIccivkOvysEajtT2rvwdcIZG2OqPc3EQ1sbDEJATM7BNWCdAEzBPwTpa6Oh19wSQ=@vger.kernel.org X-Gm-Message-State: AFq9FYLoiIftoVd/5LQobS3tiauslx2tp3HDTYa16eDOqthdRK6g2kBg SIlEijPJODA+osTkiNrHHb9WARj4YH3D8kFX+LBh3d8cf89A1HWU8cFd X-Gm-Gg: AYBFou2jFlTd1JVwmklSdp+tB/phoOhUjbUd89y8o9k4wO65KtaNwqiVXjYjwGEva8y 7KXZ0/sPPjwSwvE21qncO2Pt5MaXF0MNzrYEArxOzyArDHbmsM/lrM9L+aIyT+1cG7z8ZeqmLov FRk/xWNwCEjFp/jcn1FtC2iwKpKHlMN+JUdgQfnH0FX0EUeqz6+i5nGK1IqPcxb7MTXn/MbFGMH Kb6MR+NXaQgJNMbnA6s5mryO+fIBCzzg6WoVoZPfLLZ+NLc4wzrsOtBHjVkfeop3wahOuFjRExd 06KRBoV/z1pFGsNtfbh3Mlakx7lpp1SSFS30v+AlVJzfygIAl74rCf4LnVjsgxOEhDz1nKUjnq2 DPMOCyATMV7aLInxu9TnX/xq1l9b8hsagmnS8UaeU0KM6N9nLATBODVylyoeUOoksaQT1X1lEIz eoY5OJ+90foFxm3QEn3K2pEUSRi2CpCvP3Xk5b+GQABvdQhOuCBZbco0h3dmoS6tEHRKZ/3PmK1 S1Il6KbsAy3rK4YpMAe/MZQIkrTBiyKHOtCp/oV3iyWlA8= X-Received: by 2002:a05:600c:3e87:b0:4a0:a34:6e7d with SMTP id 5b1f17b1804b1-4a18e4bacbfmr224923095e9.18.1791895187530; Tue, 13 Oct 2026 05:39:47 -0700 (PDT) Received: from localhost.localdomain (87-205-122-125.dynamic.inetia.pl. [87.205.122.125]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48de0bc7299sm4179440f8f.53.2026.10.13.05.39.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Oct 2026 05:39:47 -0700 (PDT) From: Kyrylo Biryuk To: dm-devel@lists.linux.dev Cc: mpatocka@redhat.com, snitzer@kernel.org, agk@redhat.com, bmarzins@redhat.com, dlemoal@kernel.org, hare@suse.de, linux-kernel@vger.kernel.org Subject: [PATCH v4 3/3] dm zoned: keep polling for idle reclaim after a reclaim pass Date: Tue, 13 Oct 2026 14:39:40 +0200 Message-ID: <20261013123940.952-4-illofspeed@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261013123940.952-1-illofspeed@gmail.com> References: <20261013123940.952-1-illofspeed@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" dmz_reclaim_work() re-arms its DMZ_IDLE_PERIOD poll only when dmz_should_reclaim() returns false at the start of a pass (and, with the first patch of this series, when a pass fails with -ENOSPC). After a pass it calls dmz_schedule_reclaim(), which queues the work only if reclaim is needed right now. When a pass ends while the target is still busy and has enough free zones, nothing is queued at all. Once the target goes idle, nothing re-evaluates dmz_should_reclaim() until another zone allocation, a "reclaim" message or a resume schedules the work, so the random or cache zones that filled up under load stay full. Seen on md RAID5 members on 27 TB host-managed drives: after heavy writes the random zones stayed full for hours on idle targets; the workaround was a timer sending "dmsetup message 0 reclaim". With this patch the emptied and filled zones were reclaimed within minutes of the targets going idle, without the timer. When reclaim is not needed right now, make dmz_schedule_reclaim() queue the idle poll, so the work stays queued after every pass. It uses queue_delayed_work(), which leaves already pending work alone, so the other callers (zone allocation and the "reclaim" message) neither postpone a pending poll nor delay a pending immediate reclaim. Fixes: 3b1a94c88b79 ("dm zoned: drive-managed zoned block device target") Assisted-by: LLM Signed-off-by: Kyrylo Biryuk --- drivers/md/dm-zoned-reclaim.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-zoned-reclaim.c b/drivers/md/dm-zoned-reclaim.c index 88d56d3c86d..f1f9adf6039 100644 --- a/drivers/md/dm-zoned-reclaim.c +++ b/drivers/md/dm-zoned-reclaim.c @@ -641,7 +641,8 @@ void dmz_reclaim_bio_acc(struct dmz_reclaim *zrc) } =20 /* - * Start reclaim if necessary. + * Start reclaim if necessary. Otherwise make sure that an idle poll stays + * queued, without delaying work that is already pending. */ void dmz_schedule_reclaim(struct dmz_reclaim *zrc) { @@ -649,4 +650,6 @@ void dmz_schedule_reclaim(struct dmz_reclaim *zrc) =20 if (dmz_should_reclaim(zrc, p_unmap)) mod_delayed_work(zrc->wq, &zrc->work, 0); + else + queue_delayed_work(zrc->wq, &zrc->work, DMZ_IDLE_PERIOD); } --=20 2.43.0