[PATCH v3 1/3] dm thin: drop the grace period from thin_ctr()
From: Qiliang Yuan
Date: Thu Nov 19 2026 - 06:05:30 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.5 (15.2-15.7) 7.7 (7.5-7.9) -50%
Signed-off-by: Qiliang Yuan <qiliang.yuan@xxxxxxxxx>
Reviewed-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx>
---
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 0b65c1b09f47b..bdd250d1eb2e1 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -4292,13 +4292,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