From nobody Sun Oct 25 14:12:47 2026 Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) (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 3F337361977 for ; Sun, 11 Oct 2026 17:54:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791741296; cv=none; b=sEZTemwsjlBbPFMLEzUxb2MX/pBq8H5/OOj04c7puDjnYVILDTInNB+CEkaH3XP67X/ytZYn/Vx4ZMQ0zydCkIoWTRGCsLE6bagEK5fq6BqKEwpxpcAA0av4PkogAj9qibRVAbMddipEYcCbZc/Jhzhie7Uo8gQE7RN3A8DRIwc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791741296; c=relaxed/simple; bh=hnZPPxNjNP3M+NNFcM7Wule6SFZ3tVs/Key1ofFfNtM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LBvmXdjH1ZMEsR4/lO1KvGSApLeivnfSoMU5mTl/DLoRiPmFc7sZrs2SNg6SFJM4mn6UIX7lliIpp6V/PyftGi5Wh1LRdp8QEzBj5b2Crf1AEG9/gbdT50T6lMW9MiNRI05DMe6pQcExYN6rN7oxPuqZFxppiDI6QAIEhWR9uaw= 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=boIXmj+K; arc=none smtp.client-ip=209.85.218.46 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="boIXmj+K" Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-c2e5f8fe879so202186666b.3 for ; Sun, 11 Oct 2026 10:54:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1791741293; x=1792346093; 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=kHXmKJc8K9MpQJ3EOpjUbD2g6SFTRQKUsqdSG2/4nEk=; b=boIXmj+KIwCQ+tCu5OA8FY4+2TbXCOkwaerBlHD1E+TUQHniIv1H/g+4keJkOnvOkb EIDwAJbIBN7Ohs6D3pqMt5Qh58r2u81WqLRiOpnsjTwV/Zf9VybIaGbW9IpOECF1zYdy lc6TFTyI6HHXU3r0WAAg/mkyjI2nN8obWiAhUl4dDn0R+pT9u/FmoOnHnb8ESYUpckUj OvfBp1L/qdvm8vDO7MKfGRV7Rq0YoqldHV/7FZdzhW55QgOeAnLsq4jst3Z1D5BZkjvo gqZDlxpXr3EyrDQTlZDD1Yvzhd39odBxAwJahwxrluceB/kbe7UeZMealoG6ypxyaxBK 0/iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791741293; x=1792346093; 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=kHXmKJc8K9MpQJ3EOpjUbD2g6SFTRQKUsqdSG2/4nEk=; b=rAngDz0K4vPDdrgs3QecX0W8lfwjbcq9yLW1re5iI3GK+UWmUyvYMkyLqT4vP2+sLJ MO/BlnakGXQNw+aPv3O8bPmW0ZVTMZcY3QfgwxIUgpCILAfUo0iUweVTbNURTtf5MOmc 9mswh2VwHFdG6zGz6m+z2ASRAZesnjgHb4Sz6zKNI7lrX/GfE+dIs9VZ8zPQryhOrZw9 w8FUyYoyA5pggAjfaqH0imZOJKVgoBNwrKgh2AkuYBRbIh5JEf9M2OVdS6erFmDpNhvY +civvkSqWGLziIVJr+bHBBKX8fE844Hgzcl13n6CKqXs3DaWkRjcNrrNfKbp/06QDngf GLjg== X-Forwarded-Encrypted: i=1; AKwUvBwIZN87KKbxVPGsibEUF+GIf/tPjXwKpaA6zR5F2ianZt811srMuHBDLaoEyCENzo5A+mr6ufrTR4XVff0=@vger.kernel.org X-Gm-Message-State: AFq9FYIcfol60E/tbNo7oszubCzqshqVZNzngKuYhg/rkytdMGshBfVC qpV8FuAHaBJfE3PZ+REvM1JZRql3OiIqBvCi3gnWgjmA8zGyAeIDM5yB X-Gm-Gg: AYBFou12RpoP09SEBUypAamlilFxKMbjw3csFqAJYORjU+QEZfQSppLftYvPw3Law8D 1NfE44/JXxTpRiDfCkS0HK/976vmOXPDD2aKjgqT7AMJ8XNrRP+ALeQp+PnpQPqmJ7QIt4u19jT Y8FL9f6sUQ4N1Q2QHLu5k4glzeWUh3cQLHBSq/XT5C0uyD8rYXm3DFTyyNW2+xCuDVTisTVX1ML TuHuWV9vT9udkhRFJTc9NMg4dxsdHcUeD4DCZVpffmUg9GzYRgSksbt4GVdd3SQM9fW3AJhXkIC 2RmwEPRUX2lebPXiXHjBuKz/A+y5tsCq2SYrkEQLN512Otbo46Swh8AtTIOLSWNCQVXWJO81dMp NoFyXi1gaF4NZ3TA6NgiAJCOzQeJ+xoo+O6GgyLb4t8gRlpNDoRPsqvvlkJeA/W798E57Cn8NEe LFGHX+WZ8GOtx/lKdd5cvsF7HUvusrY/7fn3hpccWMFDJ2ULUwt6/K1feKWS/WDPM503ffYSQpT F4AJofzxhSqzbGSrCBURteoZpdpLVGSxAcufCLy2grwfwM= X-Received: by 2002:a17:906:f5aa:b0:c26:19de:9ac5 with SMTP id a640c23a62f3a-c31aa0960bamr707128866b.29.1791741293351; Sun, 11 Oct 2026 10:54:53 -0700 (PDT) Received: from localhost.localdomain (87-205-122-125.dynamic.inetia.pl. [87.205.122.125]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c31a9a9f776sm376806366b.48.2026.10.11.10.54.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Oct 2026 10:54:53 -0700 (PDT) From: Kyrylo Biryuk To: dm-devel@lists.linux.dev Cc: agk@redhat.com, snitzer@kernel.org, mpatocka@redhat.com, bmarzins@redhat.com, hare@suse.de, dlemoal@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/3] dm zoned: back off when reclaim finds no destination zone Date: Sun, 11 Oct 2026 19:54:48 +0200 Message-ID: <20261011175450.952-2-illofspeed@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261011175450.952-1-illofspeed@gmail.com> References: <20261011175450.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 a 7.2.6 kernel as an out-of-tree dm-zoned module, together with the next two patches, on emulated host-managed drives (tcmu-runner ZBC handler) and on three 27 TB host-managed drives used as md RAID5 members. Assisted-by: LLM Signed-off-by: Kyrylo Biryuk Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- 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:12:47 2026 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (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 DEA50382381 for ; Sun, 11 Oct 2026 17:54:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791741297; cv=none; b=ug75Z7THO3jGumKepgxi0pvWELf4fuLBCPvyHPQAqdDJAEs8Ek1TZorz5pGh71thlpPFjn9EJ6af774zvfFO3d/wdpSmSZNvNjOaug9kx1DxV7j/2o3z0UCgmHInZV57Bw0+RTKjILgxFMSHKDlVHx06/SjsqtHubDeODrsuHSE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791741297; c=relaxed/simple; bh=K0CZG7xuPILHEy3PPebGGH33gpysZhnHLPL0yIEoyVM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WJ7r1MatJ58ehhp56/U10doxf8w0ppjDV9KXB/mY0MrPNTk/L5XZocyOogQ2oPDXmHy03QM0F1wqe7h2+gIzU0CY6NsHL8VcqkA+kPGicxse7l/U7LKOUb2LaOKqhfBSJ/QQUqarQTr+0sqmFQrvf+mYFGb5QDMn5BK4JDRtFDA= 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=snb2eJkK; arc=none smtp.client-ip=209.85.218.50 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="snb2eJkK" Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-c2e3846d1caso209783566b.0 for ; Sun, 11 Oct 2026 10:54:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1791741294; x=1792346094; 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=fSdAx+YZhxSx7N8hRcIJeT1HZY3ybyZ+3/WgKoWE36w=; b=snb2eJkK3vuHMQqrvgtNB1JA6+nyfRmPOzpIaRkrmlk3LIIOrvPjulwaaFJ2yg2vMU etYwyoZQb6WWHMBL5uSYX9Zcd3jeux2lUwO2H83h9i3i8ayOnoZIqvs/HofeTqo1Cvij Esez4fOJGSImkQcm0RS352ojAo4cy5UO8dnfBL/H61dpVMZpQJxmOiYg/N44Ft896UeI 5CrBSDvqMEKfE83wSV22tfStsIldwNql5QvrL7XTgiD1Y4MYX+mH7Niq80CLj22JpcRq Xxcr95aJmKKBeFz8LzEaEFpYlQGB5Vsl+oT2po9zDCewW6JDqRQZnU56h65JfEVAcAL6 yuUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791741294; x=1792346094; 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=fSdAx+YZhxSx7N8hRcIJeT1HZY3ybyZ+3/WgKoWE36w=; b=GEWRmZ3BlPm0+tiVPmFpsneaY69L4WrgXNDbTB9bpQM4mAUI8KNnpYbFe77D8wpdrG 0y/jdQ07i5R9kwy/qGuHi6BNHq/AeQl2gJIY+vahIWBk8BUl1eg9+/pEDEU6PMFsdndZ u/t8org7+47QaBQ6CETwBIRD5viDJu25r0hEy+cwKU7y4WQYCo2GNlxXRoghgWCj39TH T8f2Dp3Z3TlrhPYx+HP8B+pC6u7JMen4mUBxX36MmNHljQZm2DK8NfK39FHwgKW7mZPN UyXK44v55rNCEZeNRzKaJ93JJNWTGCLn0SAWDukyXlvZi1JGdBgDZ9ImwTWXKems5eOq CU1A== X-Forwarded-Encrypted: i=1; AKwUvBxrNNwxOY7rT+zhmGm2PlyQP1slNCDh/bKKuhuqnC+d59cX5qh0aPyAxl5LJiC2W8QJhNEkpxOhFK8zf8w=@vger.kernel.org X-Gm-Message-State: AFq9FYLuWvjlXf0FDHj4PlvDM6JaTGwu/VduswTg1F1m62Jc/JYw6UTT kMwb2lkNx7khPOfxupf2MZlwvUFiSwAnegeiWfUx6t5FtXQ3VB8S17JT X-Gm-Gg: AYBFou3dJcovcC2YVbEWWWOilOduzVfrmQcOLRUZY7kGfRtE+YeDgzOY4GGPxti+Lzj JDS0Fu22UGwTaGHCEnJNhnKXu7rqNTdCSCn7dRh5LqyyW0wtJE5a9hN38FnoMyGIle988q59kyl LVglvEmlOzj3RMx9evDaj8ShyZngtUcQYhvW7I3KqonrFXDUObgGcFpc7qruSPyCxImbWJ3vlGJ MadpTAQ2pVcyiXqkpRxDH/QUG1D5k783s5YkAuiFG65TjZme5jIAUvFS2mBOjBoHrJlz5I/9t9A yNpbflj0xCxS5KeLsAS5y9cq9MzpwzYKj5OsADonvtPql93odhT113f6BkrpL5sdy0LRrkYyasB a9BQa3x1pG3Fgi9zxtsbyOT6vOWJkrUIZ4hof6sTAiyLdM2mBl3GaZlaHls9b5/k53x3BHVHBd9 P6iATfVH6rUlkkWxjM1VgtiZBt9hEFYFCz68v5HmjZPNJtpHG3E4solJXKZfsE4J5ZKLCZjeUjb oobq801Kscel5p6SQjCTdIY0er9jVQlwf37QhnA6SZS45o= X-Received: by 2002:a17:906:d54f:b0:c2e:7fe7:289f with SMTP id a640c23a62f3a-c31a9d31c9dmr763732566b.25.1791741294120; Sun, 11 Oct 2026 10:54:54 -0700 (PDT) Received: from localhost.localdomain (87-205-122-125.dynamic.inetia.pl. [87.205.122.125]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c31a9a9f776sm376806366b.48.2026.10.11.10.54.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Oct 2026 10:54:53 -0700 (PDT) From: Kyrylo Biryuk To: dm-devel@lists.linux.dev Cc: agk@redhat.com, snitzer@kernel.org, mpatocka@redhat.com, bmarzins@redhat.com, hare@suse.de, dlemoal@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/3] dm zoned: do not reclaim a random zone into another random zone Date: Sun, 11 Oct 2026 19:54:49 +0200 Message-ID: <20261011175450.952-3-illofspeed@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261011175450.952-1-illofspeed@gmail.com> References: <20261011175450.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") Assisted-by: LLM Signed-off-by: Kyrylo Biryuk Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke --- 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:12:47 2026 Received: from mail-ej2-f11.google.com (mail-ej2-f11.google.com [74.125.228.139]) (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 E181943DEBF for ; Sun, 11 Oct 2026 17:54:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.139 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791741298; cv=none; b=gDN5sU4XR8F+JgetFruJphS4//aMkDvubGAFRz42ezXkbtcRw5UeVAMRa6u0QS1v9/b51H+IMakIzB1aqphbmHgwH33hC0WOmKRYWcV5qNtTwlqCKUZPf8GgO8w/67F0L7yQ9hqUUIxhoc2WZuaa9IP23WRPMhu3kU2CINhmLSI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791741298; c=relaxed/simple; bh=mh0naAZ5rGdtBm3SRObJJh3xiuOOeB+3Lk4WoYcj6y8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ARRXI6TSmSuEP/5LqDsfr9n4MDFetqx+wptJPGou+Dk4Gr0z4694qfAewjR76QV6qOQUSqD/AgJEKT3wjXrj21/XmYZW1PAK8HO8lhYuq8kqqkXmge5iOsTCa1XoQC90m/18B6Oq9OlK7U27ZuAo0YoX2sE6qWkpDDqkQOxz59E= 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=DCiEuMfV; arc=none smtp.client-ip=74.125.228.139 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="DCiEuMfV" Received: by mail-ej2-f11.google.com with SMTP id a640c23a62f3a-c2e25574351so114206866b.1 for ; Sun, 11 Oct 2026 10:54:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1791741295; x=1792346095; 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=AXeUGkwkx/B0ZcB6bHet0Ei8c4WjWUt9Suh2yBdHG08=; b=DCiEuMfVlzTy2yShKI4QywKyp7JuXMHypFSYbZIWtPS0mGHVY50tSHJWDqP4mZ0dq2 QsSy8rqWKQBOgOaOGReurnPo+uuDMOtwTa7Fj8KmqURi//nfua1y2Zxf0F9OaVhSweee GzNh4A09xy0yF1/dGIDwXMYkeOFMrb8Wt/zvgAhKdbUl1OgsiQ5KHUpusXm9sMX2qXjR y2rHHyK4r9F63LfmwTt+D+o4eu2ur838UUaLKKreEL8CcOKxT6M+hijjUi7ElaTVTlAU TNhgHG55bJQLM8SD1xB/IEbuz5wJV6dQ7rrklj+a5ltxEZBKm5AIkLoxR0Qi612iyGFD gqFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791741295; x=1792346095; 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=AXeUGkwkx/B0ZcB6bHet0Ei8c4WjWUt9Suh2yBdHG08=; b=parRBrp8VIAONqUcsgQ2SgF8LvpGysOkfnm6xiRiA9ghEQB/IwO3KCtVC8fzNXrmwc wu6A5cB022MpelLeF+9l4BsfBiAn2v6Gm3lMXaN7Vsq1lcX9Y2rU9MCQ8CNgwfR5Z1/4 yr2eRmM+930mTSmq2JOGaeuRpDyClYt6ze/NFcTS3buk7vRhmzQBHdaJB1tGyavpWQ63 yVDceqCGKw/20SkXYIdCDHr8Gr9tJE4dgAv2RcYqafXHF2mxMUW/BfG7o9tM6ffTpd4u aadBUJReznG1lUEVQa1GyHv1M06E11y+ZEn9Dac0zAsXHSi7dWRcYzTR4vHBl1BnGM7D WO7g== X-Forwarded-Encrypted: i=1; AKwUvBzmBl6o7CyRtN2/YBqXiMIzglMO75JWvJx+704OA6UOFKwAUMPriCqC/yvbulJlaBgPsjLmJLP5ECGmIVk=@vger.kernel.org X-Gm-Message-State: AFq9FYIJkZCoyBiYSZqo1IgmylGdzXO1klpd7m4sWSEmwYDvmUAWdCAV Tv6G2KAi0jTmECPQyFntOOQzh4/zH0E+3FZeigv430pyqZ03o1+y7obh X-Gm-Gg: AYBFou3N7rZiaJm0TqEivTViom+YplndAqHEQ8dFh4BeBg9ch9dY33eIgYU0Ee6tMLV 0Xc6lasjPMZNEkIbeX7JulCrQy3qdCLhNLUDQxqUHUgLpqN5c/wZDnCTDOCl1eTKrxgsn0kVEsZ I/dEs95N7NZG42OAI21mAcOlBBGmT0kYCnvk/g3jrF2jDBSgiX6hpqkNaKCMtRE/otMf0JTSONM dwjf8z/icHyzw9umblzR/FAM6xyWOoNnu+8nFf8ql939fXCfEBrsq6JfyRhEO1+7Yy9tWgLEtiO qliAWNZD5VsW550RKc7XQ//bW8gEPHN0V1r+6DUhUGChpx58nNT3vpA8DYd7lf0RYrc3Gy0nY9d XaAciV6/oErraqNjcsovJefka3Wl944M9vzeb184y/bko0jgVrBe+C/pMwxijm/nyPDuD2h/itP L24cerqqpvedEjl6GnzXPg7jVIKYYrcK8wxXcXvzEAQOTfTvhZXMC78VB935MUfRhcvbl0gsCTN 1n1sIufoipR2s4fmsqaSidFn41ewJSiFZQcciHRKvWKcEA= X-Received: by 2002:a17:906:7956:b0:c2b:898e:24fd with SMTP id a640c23a62f3a-c31aa0857f1mr838591166b.33.1791741294891; Sun, 11 Oct 2026 10:54:54 -0700 (PDT) Received: from localhost.localdomain (87-205-122-125.dynamic.inetia.pl. [87.205.122.125]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c31a9a9f776sm376806366b.48.2026.10.11.10.54.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Oct 2026 10:54:54 -0700 (PDT) From: Kyrylo Biryuk To: dm-devel@lists.linux.dev Cc: agk@redhat.com, snitzer@kernel.org, mpatocka@redhat.com, bmarzins@redhat.com, hare@suse.de, dlemoal@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/3] dm zoned: keep polling for idle reclaim after a reclaim pass Date: Sun, 11 Oct 2026 19:54:50 +0200 Message-ID: <20261011175450.952-4-illofspeed@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261011175450.952-1-illofspeed@gmail.com> References: <20261011175450.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. 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 new I/O arrives or user space sends a "reclaim" message, 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. After a pass, requeue the work immediately if reclaim is still needed, otherwise re-arm the idle poll. Fixes: 3b1a94c88b79 ("dm zoned: drive-managed zoned block device target") Assisted-by: LLM Signed-off-by: Kyrylo Biryuk --- drivers/md/dm-zoned-reclaim.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-zoned-reclaim.c b/drivers/md/dm-zoned-reclaim.c index 88d56d3c86d..5084e10ea7e 100644 --- a/drivers/md/dm-zoned-reclaim.c +++ b/drivers/md/dm-zoned-reclaim.c @@ -556,7 +556,16 @@ static void dmz_reclaim_work(struct work_struct *work) } } =20 - dmz_schedule_reclaim(zrc); + /* + * Keep the worker alive: when a pass ends while the target is busy + * with enough free zones, dmz_schedule_reclaim() queues nothing and + * the idle poll is never re-armed, so zones filled under load are not + * reclaimed once the target goes idle. + */ + if (dmz_should_reclaim(zrc, dmz_reclaim_percentage(zrc))) + mod_delayed_work(zrc->wq, &zrc->work, 0); + else + mod_delayed_work(zrc->wq, &zrc->work, DMZ_IDLE_PERIOD); } =20 /* --=20 2.43.0