Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1428739rdb; Wed, 6 Dec 2023 20:42:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IHH9WOBAjj4xlCMb+LkKCNHhtDS/JUYIflSvqbH75JIWU5FuABtb1dy9HXIYIoknfOlTpmX X-Received: by 2002:a05:6a00:2989:b0:6cb:87d0:fc9e with SMTP id cj9-20020a056a00298900b006cb87d0fc9emr2187649pfb.21.1701924135848; Wed, 06 Dec 2023 20:42:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701924135; cv=none; d=google.com; s=arc-20160816; b=0bwYCRujJmrVPbiJE3MkNrJbhCnkcWolEGZubXrkHferUSVvBzzEAeOzhiov53PQZa /JG6A8En/ltm3YFSJR4Sb+cMer651gS0BkRaDQZwi0tXzRIKua7CRZOniPrEL7P7HTaE YxMK5OURFsj1vZyD3aA7d1Zhd08up+xfnAAvUoMmyg5VCsFayUo9IcFIxFeAt9uVN28q YMV4Wgu9RpU+2WB2n4sAn1DxEWSBajsCXhfb3w7vy4jktQy1x6EUwbrChdnzp5dTfau7 d/FYSE9o8Q5MAjGecxyt6LW2t2uzCVHL9HJCy0+Xsy4wN/uJMupw8dZB4BXdE3WfCF9z mj5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=v2QqlXWCI26gv+jGfNp5oJjKdW8trvqIMxHSQSlEVHs=; fh=BE06UYBecxVufntv+tlhTxnSeerzJIvnDscwt9DWB3Q=; b=momZPANEQwRhq8T3Ah5C8tZ5PjtPH3zXaZP3N71ib681bpwyxlLsylep1CNL0OhQpp TQQpnCw/Uhi3RjhtbQhw0EPjAFrlyMNHP5uFyZ4TTpC59vijBi4kVzXJ6ssBUjoac18w 8FFGHVh/itf/t4/1iFCbP5YKuvzDUMfi/bafdF4FFnHMiatZbIvbKzwN3xgNBr1Z/D5z Oz9IJhjSlgjlq+qb4tSCaVEtY/RGczGWAWFP+f0MOxVvFl9NrpCusyc4Bzf6806Cq9ba hxeyTIBuPHdBiNeVg/5J1wfI0BCaCHC6X52FHi+nfmddEbIAyLtTFnY84+TcuCxQyrQJ jgvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fromorbit-com.20230601.gappssmtp.com header.s=20230601 header.b=MKoR0dcr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id p68-20020a634247000000b005c6259da621si461496pga.555.2023.12.06.20.42.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 20:42:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@fromorbit-com.20230601.gappssmtp.com header.s=20230601 header.b=MKoR0dcr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id CBF9A8280835; Wed, 6 Dec 2023 20:42:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229484AbjLGElz (ORCPT + 99 others); Wed, 6 Dec 2023 23:41:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbjLGEly (ORCPT ); Wed, 6 Dec 2023 23:41:54 -0500 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2340126 for ; Wed, 6 Dec 2023 20:41:59 -0800 (PST) Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-286d6c9ce6dso551258a91.2 for ; Wed, 06 Dec 2023 20:41:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fromorbit-com.20230601.gappssmtp.com; s=20230601; t=1701924119; x=1702528919; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=v2QqlXWCI26gv+jGfNp5oJjKdW8trvqIMxHSQSlEVHs=; b=MKoR0dcrSBRNJKZmpUwr0+k2U4NqHbxPyVIUTmDcvuDa7rgLcBAGAIx6zkdjjxunk4 w7HqBHmzFX3i1Bc97Y1XK7d5r1CCuRapoxS9K67ePCo0I3YjnjbM+pVs2QeX6f0T4CSC X4lqcOPh54gnrmzQegKb9Mqc0LuG5JsT/yAaKm/DSPxO8xVUYxmyTvUMALt9WWpHfbhQ LwxY/XWeUMurIzzvkthXsuHxsSFu+jkPhiY30F3uGKiiNuOUY13chSKWw8BvQXIL0Sen zokKIhg3tUngUM+yYHxk9tZwQaVS5ZPU2H737G/uSJiPK9tws8aHT/hXEQnlJbJLEKTN TPDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701924119; x=1702528919; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=v2QqlXWCI26gv+jGfNp5oJjKdW8trvqIMxHSQSlEVHs=; b=uXXit1JQnE71g6kGZ6JV1wWkKNy8gezucYztUAtL2LV68tki8E1aJu78s6RNioWLHz 6oJvWaQdOTtjzSxw28XRk6pj243+t/Y1YPQaxSJ/nFJqz7sj2BFJBR58VqLp97OeD1uj E7hHyHDyS+KRsLPRmotssGDjxiIqGJi2LqX8tKJQHl2be+2alu444pwjSN6zg5z0Dmw7 qVYwmEE3uxKgSUHAbvigK/4y+H1G8/ovYa5npgwabG2XGOlLZX+oO9oC8bvPqERcMLyg KSRviYaMi/Ja5vdAb0siwpzTKYy1apdLdppXX01Qu3SomF7SobzUeKmJL08ibp/uj5tW POnw== X-Gm-Message-State: AOJu0Yyy/1fSwhZjzep5L2P1HP5ZyzETrDnZpik1VWaGCqDv0WLtVxTc rSLpTXvPyJGHzUSp5VEdt/9RAg== X-Received: by 2002:a17:90a:ff14:b0:286:6cc1:781a with SMTP id ce20-20020a17090aff1400b002866cc1781amr1867568pjb.93.1701924119432; Wed, 06 Dec 2023 20:41:59 -0800 (PST) Received: from dread.disaster.area (pa49-180-125-5.pa.nsw.optusnet.com.au. [49.180.125.5]) by smtp.gmail.com with ESMTPSA id mm22-20020a17090b359600b00286901e226bsm293341pjb.28.2023.12.06.20.41.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 20:41:58 -0800 (PST) Received: from dave by dread.disaster.area with local (Exim 4.96) (envelope-from ) id 1rB6Cy-004vYN-0Q; Thu, 07 Dec 2023 15:41:56 +1100 Date: Thu, 7 Dec 2023 15:41:56 +1100 From: Dave Chinner To: Kent Overstreet Cc: linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-cachefs@redhat.com, dhowells@redhat.com, gfs2@lists.linux.dev, dm-devel@lists.linux.dev, linux-security-module@vger.kernel.org, selinux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 10/11] list_bl: don't use bit locks for PREEMPT_RT or lockdep Message-ID: References: <20231206060629.2827226-1-david@fromorbit.com> <20231206060629.2827226-11-david@fromorbit.com> <20231207041650.3tzzmv2jfrr5vppl@moria.home.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231207041650.3tzzmv2jfrr5vppl@moria.home.lan> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 06 Dec 2023 20:42:13 -0800 (PST) On Wed, Dec 06, 2023 at 11:16:50PM -0500, Kent Overstreet wrote: > On Wed, Dec 06, 2023 at 05:05:39PM +1100, Dave Chinner wrote: > > From: Dave Chinner > > > > hash-bl nests spinlocks inside the bit locks. This causes problems > > for CONFIG_PREEMPT_RT which converts spin locks to sleeping locks, > > and we're not allowed to sleep while holding a spinning lock. > > > > Further, lockdep does not support bit locks, so we lose lockdep > > coverage of the inode hash table with the hash-bl conversion. > > > > To enable these configs to work, add an external per-chain spinlock > > to the hlist_bl_head() and add helpers to use this instead of the > > bit spinlock when preempt_rt or lockdep are enabled. > > > > This converts all users of hlist-bl to use the external spinlock in > > these situations, so we also gain lockdep coverage of things like > > the dentry cache hash table with this change. > > > > Signed-off-by: Dave Chinner > > Sleepable bit locks can be done with wait_on_bit(), is that worth > considering for PREEMPT_RT? Or are the other features of real locks > important there? I think wait_on_bit() is not scalable. It hashes down to one of 256 shared struct wait_queue_heads which have thundering herd behaviours, and it requires the locker to always run prepare_to_wait() and finish_wait(). This means there is at least one spinlock_irqsave()/unlock pair needed, sometimes two, just to get an uncontended sleeping bit lock. So as a fast path operation that requires lock scalability, it's going to be better to use a straight spinlock that doesn't require irq safety as it's far less expensive than a sleeping bit lock. Whether CONFIG_PREEMPT_RT changes that equation at all is not at all clear to me, and so I'll leave that consideration to RT people if they see a need to address it. In the mean time, we need to use an external spinlock for lockdep validation so it really doesn't make any sense at all to add a third locking variant with completely different semantics just for PREEMPT_RT... -Dave. -- Dave Chinner david@fromorbit.com