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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CBE0C61DA4 for ; Wed, 15 Mar 2023 22:26:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231205AbjCOW0g (ORCPT ); Wed, 15 Mar 2023 18:26:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229974AbjCOW0e (ORCPT ); Wed, 15 Mar 2023 18:26:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B284968D5; Wed, 15 Mar 2023 15:26:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D4E2861E91; Wed, 15 Mar 2023 22:26:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF29CC4339C; Wed, 15 Mar 2023 22:26:30 +0000 (UTC) Date: Wed, 15 Mar 2023 18:26:28 -0400 From: Steven Rostedt To: Joel Fernandes Cc: Uladzislau Rezki , Jens Axboe , LKML , RCU , "Paul E . McKenney" , Oleksiy Avramchenko , Philipp Reisner , Bryan Tan , Eric Dumazet , Bob Pearson , Ariel Levkovich , "Theodore Ts'o" , Julian Anastasov Subject: Re: [PATCH 00/13] Rename k[v]free_rcu() single argument to k[v]free_rcu_mightsleep() Message-ID: <20230315182628.39329315@gandalf.local.home> In-Reply-To: References: <20230201150815.409582-1-urezki@gmail.com> <20230315151415.2534e11c@gandalf.local.home> <20230315153448.6914f85b@gandalf.local.home> <20230315162840.106a5b4f@gandalf.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 15 Mar 2023 18:08:19 -0400 Joel Fernandes wrote: > I am doubtful there may be a future where it does not sleep. Why? > Because you need an rcu_head *somewhere*. Unlike with debubojects, > which involves a lock-free per-CPU pool and a locked global pool, and > has the liberty to shutdown if it runs out of objects -- in RCU code > it doesn't have that liberty and it has to just keep working. The > kfree_rcu code does have pools of rcu_head as well, but that is not > thought to be enough to prevent OOM when memory needs to be given > back. AFAIK -- the synchronize_rcu() in there is a last resort and > undesirable (supposed to happen only when running out of > objects/memory). And everything you said above is still implementation, and the user of kvfree_rcu() doesn't care. The only thing different about the two cases is that one is headless. > > Also "mightsleep" means just that -- *might*. That covers the fact > that sleeping may not happen ;-). Yes, and even though you are doubtful of it not ever having a non-sleep implementation, there is still a chance that there might be something someday. > > This is just my opinion and I will defer to Uladzislau, Paul and you > on how to proceed. Another option is "cansleep" which has the same > number of characters as headless. I don't believe expecting users to > read comments is practical, since we did already have comments and > there was a bug in the usage that triggered this whole series. The point of "headless" is that is the rational for this version of kvfree_rcu(). It doesn't have a head. That's an API name that users care about. Why not call it kvfree_rcu_alloc() ? It allocates right? We have might_sleep() in lots of places. In fact, the default is things might sleep. We don't need to call it out. That's what the might_sleep() call is for. Usually it's the non sleep version that is special. We could call the normal kvfree_rcu() "kvfree_rcu_inatomic()" ;-) But I guess that would be a bigger change. -- Steve