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 6C035C001DD for ; Fri, 14 Jul 2023 13:51:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235826AbjGNNve (ORCPT ); Fri, 14 Jul 2023 09:51:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235308AbjGNNvc (ORCPT ); Fri, 14 Jul 2023 09:51:32 -0400 Received: from out30-119.freemail.mail.aliyun.com (out30-119.freemail.mail.aliyun.com [115.124.30.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B827C35A4; Fri, 14 Jul 2023 06:51:26 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=21;SR=0;TI=SMTPD_---0VnMhNu7_1689342677; Received: from 30.25.236.189(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0VnMhNu7_1689342677) by smtp.aliyun-inc.com; Fri, 14 Jul 2023 21:51:20 +0800 Message-ID: Date: Fri, 14 Jul 2023 21:51:16 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v1] rcu: Fix and improve RCU read lock checks when !CONFIG_DEBUG_LOCK_ALLOC To: Joel Fernandes Cc: paulmck@kernel.org, Sandeep Dhavale , Frederic Weisbecker , Neeraj Upadhyay , Josh Triplett , Boqun Feng , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Matthias Brugger , AngeloGioacchino Del Regno , linux-erofs@lists.ozlabs.org, xiang@kernel.org, Will Shiu , kernel-team@android.com, rcu@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org References: <20230713003201.GA469376@google.com> <161f1615-3d85-cf47-d2d5-695adf1ca7d4@linux.alibaba.com> <0d9e7b4d-6477-47a6-b3d2-2c9d9b64903d@paulmck-laptop> <87292a44-cc02-4d95-940e-e4e31d0bc6f2@paulmck-laptop> <894a3b64-a369-7bc6-c8a8-0910843cc587@linux.alibaba.com> <58b661d0-0ebb-4b45-a10d-c5927fb791cd@paulmck-laptop> <7d433fac-a62d-4e81-b8e5-57cf5f2d1d55@paulmck-laptop> <058e7ee9-0380-eb1b-d9a8-b184cba6ed53@linux.alibaba.com> From: Gao Xiang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/7/14 21:42, Joel Fernandes wrote: > On Thu, Jul 13, 2023 at 11:17 PM Gao Xiang wrote: >> >> >> >> On 2023/7/14 10:16, Paul E. McKenney wrote: >>> On Thu, Jul 13, 2023 at 09:33:35AM -0700, Paul E. McKenney wrote: >>>> On Thu, Jul 13, 2023 at 11:33:24AM -0400, Joel Fernandes wrote: >> >> ... >> >>>>> >>>>> >From what Sandeep described, the code path is in an RCU reader. My >>>>> question is more, why doesn't it use SRCU instead since it clearly >>>>> does so if BLK_MQ_F_BLOCKING. What are the tradeoffs? IMHO, a deeper >>>>> dive needs to be made into that before concluding that the fix is to >>>>> use rcu_read_lock_any_held(). >>>> >>>> How can this be solved? >>>> >>>> 1. Always use a workqueue. Simple, but is said to have performance >>>> issues. >>>> >>>> 2. Pass a flag in that indicates whether or not the caller is in an >>>> RCU read-side critical section. Conceptually simple, but might >>>> or might not be reasonable to actually implement in the code as >>>> it exists now. (You tell me!) >>>> >>>> 3. Create a function in z_erofs that gives you a decent >>>> approximation, maybe something like the following. >>>> >>>> 4. Other ideas here. >>> >>> 5. #3 plus make the corresponding Kconfig option select >>> PREEMPT_COUNT, assuming that any users needing compression in >>> non-preemptible kernels are OK with PREEMPT_COUNT being set. >>> (Some users of non-preemptible kernels object strenuously >>> to the added overhead from CONFIG_PREEMPT_COUNT=y.) >> >> I'm not sure if it's a good idea > > I think it is a fine idea. > >> we need to work on >> CONFIG_PREEMPT_COUNT=n (why not?), we could just always trigger a >> workqueue for this. >> > > So CONFIG_PREEMPT_COUNT=n users don't deserve good performance? ;-) I'm not sure if non-preemptible kernel users really care about such sensitive latencies, I don't know, my 2 cents. Thanks, Gao Xiang > > thanks, > > - Joel