Received: by 2002:ab2:715a:0:b0:1fd:c064:50c with SMTP id l26csp95164lqm; Mon, 10 Jun 2024 13:59:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVwJ5Yw/PXx2PupATMYjGWbuK76CWEXgk+6jXiuy2lgC13tvIth4N9Y2Bv/3/QAwfQpDzOamUftepIgcpDBEs/8YcMUWRDNdWod9h50Wg== X-Google-Smtp-Source: AGHT+IG6xbW4xB12Bj9P7TPs39wH6HUxzLhfelw4SQB9dfSaC3yJg0ktjSci1F4ctor2QXjnfJiG X-Received: by 2002:a05:6358:5923:b0:19f:3928:8d80 with SMTP id e5c5f4694b2df-19f3928905cmr647604955d.24.1718053165375; Mon, 10 Jun 2024 13:59:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718053165; cv=pass; d=google.com; s=arc-20160816; b=jCJIhs3j2KBTDtFgGXSQaZ66BwNFFY4fb1uQoXNKrNOM05lDVqFpQaOiVtLyCagJWR GFCcx/RyWZiNpzHT5QxTXWMEgcwO3m3ZLhJAVzGiGjR8z4OTF1z0Nz+Nr02xeMfw64yZ PLqB9McoTJUKU5u126MdWvI352UMmDxdEY39L3uvmiWXVL4okBM/igleTrxkVUGawWRk HyhZDfckwj1e/mZuGonhoRy+Ih4/TosHQxm16ZCharWYWgY8vlCoNcq0szXvF3TId+GI pfv2z+00KWsUVJw/Agolef5c+hI78lptf4uozS4Q6PPMUz0r/nvKYIgnLu8ajNIc+0we 9bGQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Y3HZtUU+Y3QR8/1rdZRdvvoYvPoLUFO5M0rso02kr/8=; fh=Tj8WHZq20aYfa0sCZvXgMQAj789XYQNsXY4uI9mh5MI=; b=aelTA8HFE8EwBhkJrK03xfZBPJbZ74mSzd7bdvQR/gGKQNbarmt7b5tgF9LGrqbu6P kX2Vbruc7Fz/FnK1EqzYLHyxjixSNEwS5n/VHilacH8DqyW03rpgywO701xy+QRsXhmK I9NdAtBAKz0G8QRU0kAxdVhRBuJdtq1f7VKGXajoqz4iL9xEywmozlHJQTeT0FGR/mMQ 1rDlx2wawfYVeXDlQwvTKvfaa3FnAj1YBy+RMoitVRhUxMRYVd4mLlZVhPw+0EEhepO0 1iM34FsBXLleeEUISqT4kbubjw9xrgUe9ao3KsPV0dGHenWJOsjrsvMv+WWqSQ9VgvYH MqBw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=cpT0ldoO; arc=pass (i=1 dkim=pass dkdomain=zx2c4.com); spf=pass (google.com: domain of linux-kernel+bounces-208897-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208897-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6b07263f081si56315606d6.598.2024.06.10.13.59.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 13:59:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208897-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=cpT0ldoO; arc=pass (i=1 dkim=pass dkdomain=zx2c4.com); spf=pass (google.com: domain of linux-kernel+bounces-208897-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208897-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 184261C2122B for ; Mon, 10 Jun 2024 20:59:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5C03658AB9; Mon, 10 Jun 2024 20:59:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="cpT0ldoO" 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 40F2917545; Mon, 10 Jun 2024 20:59:13 +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=1718053154; cv=none; b=GXZiABtSIR/CWLYuiFRSxF2L4JoHGBI3D+w39ta5GPzEj9wBhmMJpK08XweoTs3cRmvQ3JZclM7d5UMf8k7khGUght1uy2UNq9HiB0n3SrQiNiLrrWjESe5vhvbJT9E4b9VE7/8WSK91DI8GuRt77LEsLyda/YNTxkSQuZ8PPDk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718053154; c=relaxed/simple; bh=xzrFrtV9/YuSODFMr60uklTPtrtOfMY/ByLG7BfZwGg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=cqyPQ13T/8/18pYDTsI04ToV34TqGY2Ficv+HudppK/SViltTwFedStdFRH9vUKOeQkV0pVdSwB+XwlaizCokcr9JNbTPKDWvoQYX1h1bmQe8z4F1fkD6igabua4qZf3qjtdjj3BV2BjzMjjwWpcb7MQ5qpvY1559QhLHsjkNqM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b=cpT0ldoO; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 630D7C2BBFC; Mon, 10 Jun 2024 20:59:12 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="cpT0ldoO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1718053150; 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=Y3HZtUU+Y3QR8/1rdZRdvvoYvPoLUFO5M0rso02kr/8=; b=cpT0ldoOcMMVc8Lu9sEv9JV4FT2gTFNNnFlTrxNiLJUPtVER7849+99XWSMC4dmFLxycci BCA83osgbke5yqf5HGbFJ6JH7hBD0GO5RNBDtny2uMzpTlaHxR7xeFWYSu8mdmTNMAopCL r2vKizCfZM+DSxqKGxM4HWQMRMdLxTs= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id d9ebcf05 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 10 Jun 2024 20:59:09 +0000 (UTC) Date: Mon, 10 Jun 2024 22:59:07 +0200 From: "Jason A. Donenfeld" To: Vlastimil Babka Cc: Julia Lawall , kernel-janitors@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , wireguard@lists.zx2c4.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Paul E . McKenney" , Matthew Wilcox , linux-mm@kvack.org Subject: Re: [PATCH 01/14] wireguard: allowedips: replace call_rcu by kfree_rcu for simple kmem_cache_free callback Message-ID: References: <20240609082726.32742-1-Julia.Lawall@inria.fr> <20240609082726.32742-2-Julia.Lawall@inria.fr> <3f58c9a6-614f-4188-9a38-72c26fb42c8e@suse.cz> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3f58c9a6-614f-4188-9a38-72c26fb42c8e@suse.cz> Hi Vlastimil, On Mon, Jun 10, 2024 at 10:38:08PM +0200, Vlastimil Babka wrote: > On 6/9/24 4:32 PM, Jason A. Donenfeld wrote: > > Hi Julia & Vlastimil, > > > > On Sun, Jun 09, 2024 at 10:27:13AM +0200, Julia Lawall wrote: > >> Since SLOB was removed, it is not necessary to use call_rcu > >> when the callback only performs kmem_cache_free. Use > >> kfree_rcu() directly. > > > > Thanks, I applied this to the wireguard tree, and I'll send this out as > > a fix for 6.10. Let me know if this is unfavorable to you and if you'd > > like to take this somewhere yourself, in which case I'll give you my > > ack. > > > > Just a question, though, for Vlastimil -- I know that with the SLOB > > removal, kfree() is now allowed on kmemcache'd objects. Do you plan to > > do a blanket s/kmem_cache_free/kfree/g at some point, and then remove > > kmem_cache_free all together? > > Hmm, not really, but obligatory Cc for willy who'd love to have "one free() > to rule them all" IIRC. > > My current thinking is that kmem_cache_free() can save the kmem_cache > lookup, or serve as a double check if debugging is enabled, and doesn't have > much downside. If someone wants to not care about the kmem_cache pointer, > they can use kfree(). Even convert their subsystem at will. But a mass > conversion of everything would be rather lot of churn for not much of a > benefit, IMHO. Huh, interesting. I can see the practical sense in that, not causing unnecessary churn and such. At the same time, this doesn't appeal much to some sort of orderly part of my mind. Either all kmalloc/kmem_cache memory is kfree()d as the rule for what is best, or a kmalloc pairs with a kfree and a kmem_cache_alloc pairs with a kmem_cache_free and that's the rule. And those can be checked and enforced and so forth. But saying, "oh, well, they might work a bit different, but whatever you want is basically fine; there's no rhyme or reason" is somehow dissatisfying. Maybe the rule is actually, "use kmem_cache_free if you can because it saves a pointer lookup, but don't go out of your way to do that and certainly don't bloat .text to make it happen," then maybe that makes sense? But I dunno, I find myself wanting a rule and consistency. (Did you find it annoying that in this paragraph, I used () on only one function mention but not on the others? If so, maybe you're like me.) Maybe I should just chill though. Anyway, only my 2ยข, and my opinion here isn't worth much, so please regard this as only a gut statement from a bystander. Jason