Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp1031729lqs; Fri, 14 Jun 2024 12:34:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUpbUO/KiAMm1YsYwLwr6ZwoUABT1O9FimrRcaY/xYyzEpnwKZ/MegXvEAnvS3tNW81h8qY65hbB/p/hUh0Pw8jGiUmuQTSWJUbTonrdg== X-Google-Smtp-Source: AGHT+IEZ2R04pIsnH8UhTvRTWToyc+R1mIeCmacNK9ZF2HXL+abIUMXafE1UildcEx6t2HlJFJ1K X-Received: by 2002:a2e:be05:0:b0:2ec:eee:f19b with SMTP id 38308e7fff4ca-2ec0eeef79fmr32051371fa.40.1718393645716; Fri, 14 Jun 2024 12:34:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718393645; cv=pass; d=google.com; s=arc-20160816; b=Q64VgNt4gZoxxvuZPEAVrplH05PQWJR4/GSjBiUTwauWQkIlFjqUHl7F6NqqZdWiu8 Hz/OZr9ptsJB4RAQWOHr+Aym8mDyIMxO0+GUFd3/5M3hUaI+dF2lTxVxFCJpro0qaFeW dqG352J0lqHmm6pbVmLojRJrE++H/OZg7ATwfQ3xe7CwLsgS/3xiCS/sIZwQCMw8yTz8 1ySq4FdaLe/l/dYfUfPdYzjTGV5WPc9ja7CE5vNQ8oEIOnOBMDu0JL7i8tBZfJC29ZpU 0bXbLEe0sUmIcriYDkPAUf7WVKnx9H+O5Dq4d2xguu1MfQ/PGdte5isTsXttelsHLKa4 YxNQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=DXA9wvv5IhNhdgqqoog09hrS0W28PIbc3nCXFgq2mxA=; fh=m9HudTsNvI3NqRv3NGmkDLwd6zJk4UwReiEV1XbhDjI=; b=OyTu8J3fX6UoKVaDzUHd/T3CaSFIROoH0EJC60ePNQ2x4/IFmXBZeM/Ly1Z+lMwFJz szhv4HAUx9b2B7sHlh2wMA0aZhBdYhV7ddi71h0CSSqcQAdzQ1TNeHZSSLio6tUI/qTR 9oUnt7faY276iaJSubs8kMt5Ju57fxi91Q65N5J+LGpZ+5P4mloBjGq8tflnhaJXbdHd azr4Qo2a2gykRebNVJ+IEdmxwMueo564LIkDwnQWwCI6ZjJ/W1cDzw9zusaUWWrHwuBH whc+Aq6TzPIQCnOMAIohSPg+MJ8FHBXyFRbVkfblbyPGp8V1HYbvBVrveOQE/SvHDC3p e+yQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b="Piy7/8cY"; arc=pass (i=1 dkim=pass dkdomain=zx2c4.com); spf=pass (google.com: domain of linux-nfs+bounces-3847-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-nfs+bounces-3847-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f56df73bdsi204079366b.550.2024.06.14.12.34.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 12:34:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs+bounces-3847-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b="Piy7/8cY"; arc=pass (i=1 dkim=pass dkdomain=zx2c4.com); spf=pass (google.com: domain of linux-nfs+bounces-3847-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-nfs+bounces-3847-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 67FA41F2309F for ; Fri, 14 Jun 2024 19:34:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CAD331A38CF; Fri, 14 Jun 2024 19:33:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="Piy7/8cY" X-Original-To: linux-nfs@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BC8D26AD7; Fri, 14 Jun 2024 19:33:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718393638; cv=none; b=dl+pCGeNQ2hQSLtgfDQar0YVr9tBn9Xoz2YTqbNxPUcjA5EyTrRwu28myy0oAxeTQPeEPS22PYLNrJfmvyLvdkP9gO7iYohkokIA9Pc4bp+o5prIwXozRfeY3lEfzN2eIHPNb4JzWvQH3afgsMAzTOG61BJ7TsQuZkdpAhpevJM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718393638; c=relaxed/simple; bh=un2DKs68DVerlXBeKlpV6w20TzStZ/MgihGnCdsi2EU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=A5O4zg/6E5qHVKs3c8INeozn/yCj0lrM3OGaEMV7P0Y+0O6D3bR5gNgd0fArTmglhgLXkhnUt9aaXO5/h15zYzD7wXiR0UN589jbazD6q4dym9gA+Vto8AlS7sSREOCzwnnHCyWpZbIV1PVG7l0ghBlmbsBxDjKYnTtbJPzKCQw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b=Piy7/8cY; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF8CBC2BD10; Fri, 14 Jun 2024 19:33:55 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="Piy7/8cY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1718393634; 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=DXA9wvv5IhNhdgqqoog09hrS0W28PIbc3nCXFgq2mxA=; b=Piy7/8cYE5kX8QxCb1ovvf7Oew+mzdXJL4F6If9Frkz4X0RUzqFF12WjwrhUhRlUy+iIKO DoV+j//Avs/4vzAsOjkSD1yxY/bbFo9eXQkn/oEw9txGMiy9XDfptZ5hiqtMHXpzOrUrXv cPfOpW6hB2UusbVHO75CZUsDVUtb8kw= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 6d22401f (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 14 Jun 2024 19:33:52 +0000 (UTC) Date: Fri, 14 Jun 2024 21:33:45 +0200 From: "Jason A. Donenfeld" To: Uladzislau Rezki Cc: "Paul E. McKenney" , Vlastimil Babka , Jakub Kicinski , Julia Lawall , linux-block@vger.kernel.org, kernel-janitors@vger.kernel.org, bridge@lists.linux.dev, linux-trace-kernel@vger.kernel.org, Mathieu Desnoyers , kvm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, "Naveen N. Rao" , Christophe Leroy , Nicholas Piggin , netdev@vger.kernel.org, wireguard@lists.zx2c4.com, linux-kernel@vger.kernel.org, ecryptfs@vger.kernel.org, Neil Brown , Olga Kornievskaia , Dai Ngo , Tom Talpey , linux-nfs@vger.kernel.org, linux-can@vger.kernel.org, Lai Jiangshan , netfilter-devel@vger.kernel.org, coreteam@netfilter.org Subject: Re: [PATCH 00/14] replace call_rcu by kfree_rcu for simple kmem_cache_free callback Message-ID: References: <80e03b02-7e24-4342-af0b-ba5117b19828@paulmck-laptop> <7efde25f-6af5-4a67-abea-b26732a8aca1@paulmck-laptop> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Fri, Jun 14, 2024 at 02:35:33PM +0200, Uladzislau Rezki wrote: > + /* Should a destroy process be deferred? */ > + if (s->flags & SLAB_DEFER_DESTROY) { > + list_move_tail(&s->list, &slab_caches_defer_destroy); > + schedule_delayed_work(&slab_caches_defer_destroy_work, HZ); > + goto out_unlock; > + } Wouldn't it be smoother to have the actual kmem_cache_free() function check to see if it's been marked for destruction and the refcount is zero, rather than polling every one second? I mentioned this approach in: https://lore.kernel.org/all/Zmo9-YGraiCj5-MI@zx2c4.com/ - I wonder if the right fix to this would be adding a `should_destroy` boolean to kmem_cache, which kmem_cache_destroy() sets to true. And then right after it checks `if (number_of_allocations == 0) actually_destroy()`, and likewise on each kmem_cache_free(), it could check `if (should_destroy && number_of_allocations == 0) actually_destroy()`. Jason