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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7E54C19F2D for ; Wed, 3 Aug 2022 21:55:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238182AbiHCVzD (ORCPT ); Wed, 3 Aug 2022 17:55:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230499AbiHCVzA (ORCPT ); Wed, 3 Aug 2022 17:55:00 -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 033D85B07B; Wed, 3 Aug 2022 14:55:00 -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 96F1A6159C; Wed, 3 Aug 2022 21:54:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BD42C433C1; Wed, 3 Aug 2022 21:54:58 +0000 (UTC) Date: Wed, 3 Aug 2022 17:54:50 -0400 From: Steven Rostedt To: Linus Torvalds Cc: Al Viro , Sebastian Andrzej Siewior , Thomas Gleixner , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [git pull] vfs.git pile 3 - dcache Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 03, 2022 at 11:57:27AM -0700, Linus Torvalds wrote: > > I really dislike this pattern: > > if (IS_ENABLED(CONFIG_PREEMPT_RT)) > preempt_disable(); > ... > if (IS_ENABLED(CONFIG_PREEMPT_RT)) > preempt_enable(); > > and while the new comment explains *why* it exists, it's still very ugly indeed. > > We have it in a couple of other places, and we also end up having > another variation on the theme that is about "migrate_{dis,en}able()", > except it is written as > > if (IS_ENABLED(CONFIG_PREEMPT_RT)) > migrate_disable(); > else > preempt_disable(); > > because on non-PREEMPT_RT obviously preempt_disable() is the better > and simpler thing. > > Can we please just introduce helper functions? > > At least that > > if (IS_ENABLED(CONFIG_PREEMPT_RT)) > preempt_disable(); > ... > > pattern could be much more naturally expressed as > > preempt_disable_under_spinlock(); > ... > The original patch years ago use to have: preempt_disable_rt() preempt_enable_rt() That did exactly that, but an effort was made to get rid of it. But your more descriptive "preempt_enable/disable_under_spinlock()" may make more sense. -- Steve