All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qiliang Yuan <qiliang.yuan@linux.dev>
To: Alasdair Kergon <agk@redhat.com>,
	Mike Snitzer <snitzer@kernel.org>,
	 Mikulas Patocka <mpatocka@redhat.com>,
	 Benjamin Marzinski <bmarzins@redhat.com>
Cc: dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org,
	 Qiliang Yuan <qiliang.yuan@linux.dev>,
	stable@vger.kernel.org
Subject: [PATCH v3 0/3] dm thin: stop waiting for grace periods when activating and removing thins
Date: Thu, 19 Nov 2026 06:05:05 -0500	[thread overview]
Message-ID: <20261119-bug-dm-thin-rcu-gp-v3-0-c80ecc475e1e@linux.dev> (raw)

Activating a thin device waits for an RCU grace period in thin_ctr(),
and removing one waits for another in thin_dtr(). Tools that create and
remove thin snapshots for every container, such as the containerd
devmapper snapshotter, pay for both each time.

Patch 1 drops the grace period from thin_ctr(), which isn't needed.
Patch 2 fixes the pool worker continuing its walk of active_thins from a
thin that thin_dtr() already took off the list, whose successor may have
been freed: thin_dtr() now marks the thin as dying and takes it off the
list only after its last reference is dropped. Patch 3 then lets
thin_dtr() free the thin with kfree_rcu() instead of waiting. Activating
a thin device gets 50% faster and removing one 20%.

Signed-off-by: Qiliang Yuan <qiliang.yuan@linux.dev>
---
V2 -> V3:
- Patch 2: mark the thin as dying in thin_dtr(), take it off
  active_thins after wait_for_completion() instead of in the last
  thin_put(), and skip dying thins in requeue_bios() and
  error_retry_list_with_code() (Benjamin Marzinski)
- Patch 2: correct the Fixes tag to 17181fb7a0c3 (Benjamin Marzinski)
- Patch 3: keep kfree_rcu() out of patch 2, so that the fix can go to
  stable on its own
- Rebase onto current mainline and remeasure

V1 -> V2:
- Add patch 2: keep a thin on active_thins until its last reference is
  dropped, so that the worker never continues from a thin whose
  successor was freed (Benjamin Marzinski)
- Patch 3: rebase onto patch 2, which already skips dying thins, so it
  only replaces the grace period with kfree_rcu()
- Patch 1: add Benjamin's Reviewed-by
- Rebase onto current mainline and remeasure

v2: https://lore.kernel.org/r/20261119-bug-dm-thin-rcu-gp-v2-0-055d627763c3@linux.dev
v1: https://lore.kernel.org/r/20261116-bug-dm-thin-rcu-gp-v1-0-14ed3567da3e@linux.dev

---
Qiliang Yuan (3):
      dm thin: drop the grace period from thin_ctr()
      dm thin: keep a thin on active_thins until its last reference is dropped
      dm thin: free thins with kfree_rcu() instead of waiting in thin_dtr()

 drivers/md/dm-thin.c | 61 +++++++++++++++++++++++++++++++---------------------
 1 file changed, 36 insertions(+), 25 deletions(-)
---
base-commit: 4405c18c95d2d0f99f6c581ef0ee8591a1aa6ccd
change-id: 20261114-bug-dm-thin-rcu-gp-d29d4b74a0b8

Best regards,
-- 
Qiliang Yuan <qiliang.yuan@linux.dev>


             reply	other threads:[~2026-11-19 11:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 11:05 Qiliang Yuan [this message]
2026-11-19 11:05 ` [PATCH v3 1/3] dm thin: drop the grace period from thin_ctr() Qiliang Yuan
2026-11-19 11:05 ` [PATCH v3 2/3] dm thin: keep a thin on active_thins until its last reference is dropped Qiliang Yuan
2026-11-19 19:20   ` Benjamin Marzinski
2026-11-19 11:05 ` [PATCH v3 3/3] dm thin: free thins with kfree_rcu() instead of waiting in thin_dtr() Qiliang Yuan
2026-11-19 19:20   ` Benjamin Marzinski

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=20261119-bug-dm-thin-rcu-gp-v3-0-c80ecc475e1e@linux.dev \
    --to=qiliang.yuan@linux.dev \
    --cc=agk@redhat.com \
    --cc=bmarzins@redhat.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=snitzer@kernel.org \
    --cc=stable@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.