From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C3814C2BA18 for ; Mon, 17 Jun 2024 16:58:49 +0000 (UTC) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=zx2c4.com header.i=@zx2c4.com header.a=rsa-sha256 header.s=20210105 header.b=flFAYgY/; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4W2x133zw6z3g8P for ; Tue, 18 Jun 2024 02:58:47 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=zx2c4.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=zx2c4.com header.i=@zx2c4.com header.a=rsa-sha256 header.s=20210105 header.b=flFAYgY/; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=139.178.84.217; helo=dfw.source.kernel.org; envelope-from=srs0=srhl=nt=zx2c4.com=jason@kernel.org; receiver=lists.ozlabs.org) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (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 lists.ozlabs.org (Postfix) with ESMTPS id 4W2x0G4dxzz3fyQ for ; Tue, 18 Jun 2024 02:58:06 +1000 (AEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 1F8EB610A4; Mon, 17 Jun 2024 16:58:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EB0CC2BD10; Mon, 17 Jun 2024 16:58:02 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="flFAYgY/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1718643480; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3Er+nOtS55CJu3Syh5+61jyHDlq8/Vrsh+iYYZbfn+o=; b=flFAYgY/nnqqK8ubdy9niyG0NubdT4klfUfroBy/DNbbO5DVT8vPRu3BffTtJ7pQodZOaN Y3wGFg0sxRrxjV2DzwGTt5JcGvNy16RrLu7AO/l+9eaew+eczEo86Y/W+NUwvsFaEBJxH+ IIdE/u1uTCF4+OVrHDCFLUq2WCu7sHI= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 4270396f (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 17 Jun 2024 16:57:57 +0000 (UTC) Date: Mon, 17 Jun 2024 18:57:45 +0200 From: "Jason A. Donenfeld" To: Uladzislau Rezki Subject: Re: [PATCH 00/14] replace call_rcu by kfree_rcu for simple kmem_cache_free callback Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kvm@vger.kernel.org, Neil Brown , kernel-janitors@vger.kernel.org, Olga Kornievskaia , Dai Ngo , Christophe Leroy , coreteam@netfilter.org, "Naveen N. Rao" , Jakub Kicinski , linux-trace-kernel@vger.kernel.org, "Paul E. McKenney" , bridge@lists.linux.dev, ecryptfs@vger.kernel.org, Nicholas Piggin , linux-can@vger.kernel.org, linux-block@vger.kernel.org, Mathieu Desnoyers , Vlastimil Babka , Tom Talpey , linux-nfs@vger.kernel.org, netdev@vger.kernel.org, Lai Jiangshan , linux-kernel@vger.kernel.org, Julia Lawall , netfilter-devel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, wireguard@lists.zx2c4.com Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Mon, Jun 17, 2024 at 06:42:23PM +0200, Uladzislau Rezki wrote: > On Mon, Jun 17, 2024 at 06:33:23PM +0200, Jason A. Donenfeld wrote: > > On Mon, Jun 17, 2024 at 6:30 PM Uladzislau Rezki wrote: > > > Here if an "err" is less then "0" means there are still objects > > > whereas "is_destroyed" is set to "true" which is not correlated > > > with a comment: > > > > > > "Destruction happens when no objects" > > > > The comment is just poorly written. But the logic of the code is right. > > > OK. > > > > > > > > out_unlock: > > > > mutex_unlock(&slab_mutex); > > > > cpus_read_unlock(); > > > > diff --git a/mm/slub.c b/mm/slub.c > > > > index 1373ac365a46..7db8fe90a323 100644 > > > > --- a/mm/slub.c > > > > +++ b/mm/slub.c > > > > @@ -4510,6 +4510,8 @@ void kmem_cache_free(struct kmem_cache *s, void *x) > > > > return; > > > > trace_kmem_cache_free(_RET_IP_, x, s); > > > > slab_free(s, virt_to_slab(x), x, _RET_IP_); > > > > + if (s->is_destroyed) > > > > + kmem_cache_destroy(s); > > > Here i am not follow you. How do you see that a cache has been fully > freed? Or is it just super draft code? kmem_cache_destroy() does this in shutdown_cache().