mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Benjamin Marzinski <bmarzins@redhat.com>
To: Qiliang Yuan <qiliang.yuan@linux.dev>
Cc: Alasdair Kergon <agk@redhat.com>,
	Mike Snitzer <snitzer@kernel.org>,
	Mikulas Patocka <mpatocka@redhat.com>,
	dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/2] dm thin: stop waiting for grace periods when activating and removing thins
Date: Thu, 19 Nov 2026 00:24:21 -0500	[thread overview]
Message-ID: <av6IBa44Erp0gWBN@redhat.com> (raw)
In-Reply-To: <20261116-bug-dm-thin-rcu-gp-v1-0-14ed3567da3e@linux.dev>

On Mon, Nov 16, 2026 at 12:12:02AM -0500, Qiliang Yuan wrote:
> 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 lets the active_thins walkers skip thins whose last reference is
> gone, so that thin_dtr() can free the thin with kfree_rcu() instead of
> waiting. Activating a thin device gets 51% faster and removing one 15%.
> 
> Signed-off-by: Qiliang Yuan <qiliang.yuan@linux.dev>

I posted an alternate version of your [PATCH 2/2] that fixes the issue
I mentioned. Can you verify that it works for you?

I squashed it with your patch, since it your original patch did most of
the work of fixing the issue, and it seemed easier to just have one
patch to backport to fix it. I could refactor it into two patches: one
the fixes the bug, and a second that just swaps the synchronize_rcu()
for kfree_rcu(), if people would rather not mix the bug fix and feature.

-Ben

> ---
> Qiliang Yuan (2):
>       dm thin: drop the grace period from thin_ctr()
>       dm thin: free thins with kfree_rcu() instead of waiting in thin_dtr()
> 
>  drivers/md/dm-thin.c | 37 ++++++++++++++++++-------------------
>  1 file changed, 18 insertions(+), 19 deletions(-)
> ---
> base-commit: 23c62304dde29abe92013d85910d03a77dada35d
> change-id: 20261114-bug-dm-thin-rcu-gp-d29d4b74a0b8
> 
> Best regards,
> -- 
> Qiliang Yuan <qiliang.yuan@linux.dev>
> 


      parent reply	other threads:[~2026-11-19  5:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  5:12 Qiliang Yuan
2026-11-16  5:12 ` [PATCH 1/2] dm thin: drop the grace period from thin_ctr() Qiliang Yuan
2026-11-18  0:51   ` Benjamin Marzinski
2026-11-16  5:12 ` [PATCH 2/2] dm thin: free thins with kfree_rcu() instead of waiting in thin_dtr() Qiliang Yuan
2026-11-18  1:13   ` Benjamin Marzinski
2026-11-19  5:16   ` [PATCH v2] " Benjamin Marzinski
2026-11-19  5:24 ` Benjamin Marzinski [this message]

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=av6IBa44Erp0gWBN@redhat.com \
    --to=bmarzins@redhat.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=qiliang.yuan@linux.dev \
    --cc=snitzer@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®