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 X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 776FEC32751 for ; Wed, 31 Jul 2019 19:41:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5158D205F4 for ; Wed, 31 Jul 2019 19:41:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730847AbfGaTlY (ORCPT ); Wed, 31 Jul 2019 15:41:24 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:33039 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726334AbfGaTlX (ORCPT ); Wed, 31 Jul 2019 15:41:23 -0400 Received: from pd9ef1cb8.dip0.t-ipconnect.de ([217.239.28.184] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1hsuSw-0005XI-1F; Wed, 31 Jul 2019 21:40:50 +0200 Date: Wed, 31 Jul 2019 21:40:42 +0200 (CEST) From: Thomas Gleixner To: Jan Kara cc: LKML , Steven Rostedt , Peter Zijlstra , Matthew Wilcox , Ingo Molnar , Anna-Maria Gleixner , Sebastian Siewior , Theodore Tso , Julia Cartwright , Jan Kara , linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, Alexander Viro Subject: Re: [patch 4/4] fs: jbd/jbd2: Substitute BH locks for RT and lock debugging In-Reply-To: <20190731154859.GI15806@quack2.suse.cz> Message-ID: References: <20190730112452.871257694@linutronix.de> <20190730120321.489374435@linutronix.de> <20190731154859.GI15806@quack2.suse.cz> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 31 Jul 2019, Jan Kara wrote: > On Tue 30-07-19 13:24:56, Thomas Gleixner wrote: > > Bit spinlocks are problematic if PREEMPT_RT is enabled. They disable > > preemption, which is undesired for latency reasons and breaks when regular > > spinlocks are taken within the bit_spinlock locked region because regular > > spinlocks are converted to 'sleeping spinlocks' on RT. > > > > Substitute the BH_State and BH_JournalHead bit spinlocks with regular > > spinlock for PREEMPT_RT enabled kernels. > > Is there a real need for substitution for BH_JournalHead bit spinlock? The > critical sections are pretty tiny, all located within fs/jbd2/journal.c. > Maybe only the one around __journal_remove_journal_head() would need a bit > of refactoring so that journal_free_journal_head() doesn't get called > under the bit-spinlock. Makes sense. > BH_State lock is definitely worth it. In fact, if you placed the spinlock > inside struct journal_head (which is the structure whose members are in > fact protected by it), I'd be even fine with just using the spinlock always > instead of the bit spinlock. journal_head is pretty big anyway (and there's > even 4-byte hole in it for 64-bit archs) and these structures are pretty > rare (only for actively changed metadata buffers). Just need to figure out what to do with the ASSERT_JH(state_is_locked) case for UP. Perhaps just return true for UP && !DEBUG_SPINLOCK? Thanks, tglx