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=-5.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable 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 DBF4AC433FF for ; Thu, 1 Aug 2019 17:57:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B990320838 for ; Thu, 1 Aug 2019 17:57:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388060AbfHAR5X (ORCPT ); Thu, 1 Aug 2019 13:57:23 -0400 Received: from mx2.suse.de ([195.135.220.15]:47102 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731930AbfHAR5X (ORCPT ); Thu, 1 Aug 2019 13:57:23 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id AB808AF3E; Thu, 1 Aug 2019 17:57:21 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id EF9621E3F4D; Thu, 1 Aug 2019 19:57:03 +0200 (CEST) Date: Thu, 1 Aug 2019 19:57:03 +0200 From: Jan Kara To: Thomas Gleixner Cc: LKML , Peter Zijlstra , Ingo Molnar , Sebastian Siewior , Anna-Maria Gleixner , Steven Rostedt , Julia Cartwright , Jan Kara , Theodore Tso , Mark Fasheh , Joseph Qi , Joel Becker , linux-ext4@vger.kernel.org, Jan Kara , Matthew Wilcox , Alexander Viro , linux-fsdevel@vger.kernel.org Subject: Re: [patch V2 6/7] fs/jbd2: Make state lock a spinlock Message-ID: <20190801175703.GH25064@quack2.suse.cz> References: <20190801010126.245731659@linutronix.de> <20190801010944.457499601@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190801010944.457499601@linutronix.de> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu 01-08-19 03:01:32, Thomas Gleixner wrote: > Bit-spinlocks are problematic on PREEMPT_RT if functions which might sleep > on RT, e.g. spin_lock(), alloc/free(), are invoked inside the lock held > region because bit spinlocks disable preemption even on RT. > > A first attempt was to replace state lock with a spinlock placed in struct > buffer_head and make the locking conditional on PREEMPT_RT and > DEBUG_BIT_SPINLOCKS. > > Jan pointed out that there is a 4 byte hole in struct journal_head where a > regular spinlock fits in and he would not object to convert the state lock > to a spinlock unconditionally. > > Aside of solving the RT problem, this also gains lockdep coverage for the > journal head state lock (bit-spinlocks are not covered by lockdep as it's > hard to fit a lockdep map into a single bit). > > The trivial change would have been to convert the jbd_*lock_bh_state() > inlines, but that comes with the downside that these functions take a > buffer head pointer which needs to be converted to a journal head pointer > which adds another level of indirection. > > As almost all functions which use this lock have a journal head pointer > readily available, it makes more sense to remove the lock helper inlines > and write out spin_*lock() at all call sites. > > Fixup all locking comments as well. > > Suggested-by: Jan Kara > Signed-off-by: Thomas Gleixner > Cc: "Theodore Ts'o" > Cc: Mark Fasheh > Cc: Joseph Qi > Cc: Joel Becker > Cc: Jan Kara > Cc: linux-ext4@vger.kernel.org Just a heads up that I didn't miss this patch. Just it has some bugs and I figured that rather than explaining to you subtleties of jh lifetime it is easier to fix up the problems myself since you're probably not keen on becoming jbd2 developer ;)... which was more complex than I thought so I'm not completely done yet. Hopefuly tomorrow. Honza -- Jan Kara SUSE Labs, CR