From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795065870; b=TqEcxCRRp/5EpkdtFiwxYzRo2ah39QknbwaiCdH6mZcpDgvXbp+KIz+Lagh+XMD1zAs6 Sf33BnMi92n+/rI1UjjphEMMSvQfxHqarwZpWAnv/XYYuCajykI2cZZv/cs1m5+YfnJnZ vPBl12tSQdWJkahDrS/kaoYFHHgLTjjVdNeNqxMO2ORv7DFKCiOwaMCLcoIsGpKKcEjIX vB/bHoKYLBLCo0Ji+Yq5HKl0wpyO8+a7Z2PpscKwXBwArhT43orGiT0SrIMdHPC7qYfNI J5NKHC87oQHp0UYP6f0Hdvs6MJ5YPGJJ+6TEGiiNzPvrKkQ7sBf/3HSXHp8oQdYo7AA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795065870; h=DMARC-Filter:DKIM-Signature:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:Received:Received:Received:Date:From: To:Cc:Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To:X-Scanned-By; bh=5Xv6WBUpVDFZ/e1zS9/XkeBEM7xgEyFcyanxdGCDPeM=; b=CCYSNOHqXtvbe0PAp2psnwgCMRqYiiFcYAYjeThh2qXltyDJw3SFB9QHJKIgsj4wIRBw gXv8Y4hK3JJpahLCe+9aVmCgXwqgLydiI3H7mX+VWK65xLy0XhaRUWtj/q819Cz3iGbci 6XsqcU1PZ+a2NwWVhgVLz1zl7kYYxIAk/x0AHLhNxhE9hwFxHvk3EZAtAU0hYUpXkXAIJ CYOMiZXfXYke7lG0WdM2koYM3HZeK5bIR/U3GuQf4v/AbbI7VA1ruTavc9kt+k753SJzu S1sShkKlknpSzrCZqvufkhl+6+6Q3fqRRZJdzhgUQ23M4zx+x/n/hw1ZGzyTOLjxYjw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Su6avpzs; arc=none smtp.remote-ip=170.10.133.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8895C606A325 for ; Thu, 19 Nov 2026 05:24:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8895C606A325 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Su6avpzs DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1795065868; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=5Xv6WBUpVDFZ/e1zS9/XkeBEM7xgEyFcyanxdGCDPeM=; b=Su6avpzsqwf/XNpkVkaMflWEQlJuaqWxvp4LB6tvChy4+MGD51wp6LKr7dK8LIXoyInyuX WMVF2oS2WxrQtEb5TpG2/g1Tl3WgRb5HobmDqlwAUlZY2q09QSp8/BnERsh32H394hHRFX jGrDbxDcbHpjR3aytBPHE41ccoOAcwY= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-126-SOq5PNKmOZSnqGuDgEI0kA-1; Thu, 19 Nov 2026 00:24:24 -0500 X-MC-Unique: SOq5PNKmOZSnqGuDgEI0kA-1 X-Mimecast-MFC-AGG-ID: SOq5PNKmOZSnqGuDgEI0kA_1795065863 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A32661954B1E; Thu, 19 Nov 2026 05:24:23 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (bmarzins-01.fast.eng.rdu2.dc.redhat.com [10.6.23.12]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4950A30000E8; Thu, 19 Nov 2026 05:24:23 +0000 (UTC) Received: from bmarzins-01.fast.eng.rdu2.dc.redhat.com (localhost [127.0.0.1]) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.18.1/8.17.1) with ESMTPS id 6AJ5OLoa510804 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 19 Nov 2026 00:24:22 -0500 Received: (from bmarzins@localhost) by bmarzins-01.fast.eng.rdu2.dc.redhat.com (8.18.1/8.18.1/Submit) id 6AJ5OLA2510803; Thu, 19 Nov 2026 00:24:21 -0500 Date: Thu, 19 Nov 2026 00:24:21 -0500 From: Benjamin Marzinski To: Qiliang Yuan Cc: Alasdair Kergon , Mike Snitzer , Mikulas Patocka , 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 Message-ID: References: <20261116-bug-dm-thin-rcu-gp-v1-0-14ed3567da3e@linux.dev> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261116-bug-dm-thin-rcu-gp-v1-0-14ed3567da3e@linux.dev> X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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 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 >