[PATCH 1/2] dm thin: drop the grace period from thin_ctr()

From: Qiliang Yuan

Date: Mon Nov 16 2026 - 00:12:25 EST


thin_ctr() adds the new thin to pool->active_thins with
list_add_tail_rcu() and then calls synchronize_rcu(), so that a
wake_worker() call can't miss the bios of a thin that isn't visible yet.

The grace period doesn't make the entry any more visible. A worker that
walks the list after list_add_tail_rcu() finds the thin, and the thin
gets no bios before its table is resumed. A walk already in progress may
miss it, but the wake_worker() for the first bio queues the worker
again. Still, activating a thin device waits for a full grace period,
which takes about half of the activation.

Remove the synchronize_rcu() call.

Activating 100 thin devices of an idle pool with dmsetup create takes
per device (mean of five rounds, min-max of the rounds in parentheses):

before (ms) after (ms) change
15.4 (14.9-15.9) 7.6 (7.3-7.8) -51%

Signed-off-by: Qiliang Yuan <qiliang.yuan@xxxxxxxxx>
---
drivers/md/dm-thin.c | 7 -------
1 file changed, 7 deletions(-)

diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index 358ed77ffb2be..d5ff937eeacba 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -4289,13 +4289,6 @@ static int thin_ctr(struct dm_target *ti, unsigned int argc, char **argv)
init_completion(&tc->can_destroy);
list_add_tail_rcu(&tc->list, &tc->pool->active_thins);
spin_unlock_irq(&tc->pool->lock);
- /*
- * This synchronize_rcu() call is needed here otherwise we risk a
- * wake_worker() call finding no bios to process (because the newly
- * added tc isn't yet visible). So this reduces latency since we
- * aren't then dependent on the periodic commit to wake_worker().
- */
- synchronize_rcu();

dm_put(pool_md);


--
2.43.0