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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 559B1EB64DA for ; Fri, 14 Jul 2023 13:51:41 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4R2Xvb6yB0z3c7v for ; Fri, 14 Jul 2023 23:51:39 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=linux.alibaba.com (client-ip=115.124.30.101; helo=out30-101.freemail.mail.aliyun.com; envelope-from=hsiangkao@linux.alibaba.com; receiver=lists.ozlabs.org) Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4R2XvT6fMZz30hQ for ; Fri, 14 Jul 2023 23:51:32 +1000 (AEST) 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 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 X-BeenThere: linux-erofs@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development of Linux EROFS file system List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-team@android.com, paulmck@kernel.org, Will Shiu , linux-erofs@lists.ozlabs.org, Boqun Feng , Lai Jiangshan , Josh Triplett , Steven Rostedt , linux-kernel@vger.kernel.org, rcu@vger.kernel.org, Mathieu Desnoyers , Matthias Brugger , linux-mediatek@lists.infradead.org, Zqiang , Neeraj Upadhyay , Frederic Weisbecker , linux-arm-kernel@lists.infradead.org, AngeloGioacchino Del Regno Errors-To: linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Sender: "Linux-erofs" 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