Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2222400pxb; Wed, 30 Mar 2022 19:49:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpPbtkhFofxVTHn1qpcTfAZarXnQHCFDRtWLmoiNUPnGuYC9N9oxNTBhN5+DIWEX2MEFSg X-Received: by 2002:a63:7f50:0:b0:386:2b5c:9d16 with SMTP id p16-20020a637f50000000b003862b5c9d16mr8884923pgn.153.1648694984561; Wed, 30 Mar 2022 19:49:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648694984; cv=none; d=google.com; s=arc-20160816; b=0PzcwPh1L0xtFvaoOkC8GEKnGBcPBXHy8CLcuHXVbEVDJ2RgDremMMQbxbTSaauylj HwBayiZCRk/CMpvy/ix3TEjp2KOhxwuSvMIyKmRxuRBfGI0TLhQggGzzm1uMGoF90xoq QO5Wmb55LcqHGEUBDR6PYavW5JVpLJOSZPiwKfAWNlil5PkloXulfb14qTuuNosmDn6j cvmBt++HGI+rXlsAZqsUgT0nad2PwpUJwGUd8/qR/FONv0zeawA6By5XrkufZDFTpD5Z JgI3whz321W8+dWAsVX42MXTbq2NeR1GXS18CkLTpO4F3V579D0YOMWL2VBYPnJS9G5K MvXA== 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:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=VKsOi5t5e7nhuUFGko8YFSn11yXfPQIhTH3ahawnu9o=; b=fKapBonxD51Td/jgQc6BfS1p2AXSLrrrAlBXdcHVJNDhGYe0F5Leg4KmYrgWzJCbf0 3DcM4DpoV6ltH7p8+YgKRSlZddawwdwlVMLIr5UUrrIC2mt0GxrPxEfIO4PgYAddQ2O4 ge2qrEN1eNsbd3pYM5JmlbqEnlG5vTr/i4r05k+lYLStFVwPt5CtJXoEyKigiI6Xu2Yg 8Bx/eIFw2NDWhiveg9qIy/ZLchU4YX91jB3UHspV7KS20IYQI/NU1jI3x2jGMSTirJH3 JE8oM/Ar2rbeWGuqRzoabQHm9IdjVQy2etdBQeQ//qaHoG6FAwYsmmvyfRqVwKEyf4MZ S2lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=szSWw17e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 144-20020a630296000000b0038214243fabsi22338863pgc.564.2022.03.30.19.49.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Mar 2022 19:49:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=szSWw17e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7BB80C1C90; Wed, 30 Mar 2022 19:38:13 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350952AbiC3UWv (ORCPT + 99 others); Wed, 30 Mar 2022 16:22:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231191AbiC3UWu (ORCPT ); Wed, 30 Mar 2022 16:22:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 064A6E71; Wed, 30 Mar 2022 13:21:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 72F7F61625; Wed, 30 Mar 2022 20:21:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8C68C340EC; Wed, 30 Mar 2022 20:21:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648671662; bh=6E/t3geIzNsmY/ab+pp1pECJf+JOpjNODtEht52eKOM=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=szSWw17ets4dkcBM0wRneEuLCQ6b4ggAmBQQVWbS1g/TG/07ZvEYxfpC/pg1drBpE me/KWNBIiXjyeFbeRlz/lIx/UDnCeO2KojQcSxBEnZ53OVQNMRPT2LINBq430Wf5Rk 4T/taTu9owQo6o9SHg+gt5ebx2vwutVmKsjHWl2gdAhpH98EdOut5ALvENQeALA+hQ X8wuSx9Ulrk70piWzRy6OZUYeU/bqW65GARvBGGZRu0qi7GaD2m7hlrcKyFaV+rVq8 RMXnrzQxriYFq0AfwM86lpiJZCN+BCah+PNBeFOx6naAL0dFkcUrmkgbRInNSYy3uU P67uQPuDdllFw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 5FB9B5C12E4; Wed, 30 Mar 2022 13:21:02 -0700 (PDT) Date: Wed, 30 Mar 2022 13:21:02 -0700 From: "Paul E. McKenney" To: Uladzislau Rezki Cc: "Zhang, Qiang1" , Sebastian Andrzej Siewior , "frederic@kernel.org" , "quic_neeraju@quicinc.com" , "josh@joshtriplett.org" , "juri.lelli@redhat.com" , "rcu@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v3] rcu: Only boost rcu reader tasks with lower priority than boost kthreads Message-ID: <20220330202102.GN4285@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20220311022226.595905-1-qiang1.zhang@intel.com> <20220316165931.GI4285@paulmck-ThinkPad-P17-Gen-1> <20220318145738.GY4285@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 30, 2022 at 09:35:26PM +0200, Uladzislau Rezki wrote: > > On Fri, Mar 18, 2022 at 05:50:35AM +0000, Zhang, Qiang1 wrote: > > > On Sat, Mar 12, 2022 at 03:11:04AM +0000, Zhang, Qiang1 wrote: > > > > On 2022-03-11 10:22:26 [+0800], Zqiang wrote: > > > > > When RCU_BOOST is enabled, the boost kthreads will boosting readers > > > > > who are blocking a given grace period, if the current reader tasks > > > > ^ Period. > > > > > > > > > have a higher priority than boost kthreads(the boost kthreads priority > > > > > not always 1, if the kthread_prio is set), > > > > > > > > >>This confuses me: > > > > >>- Why does this matter > > > > > > > > In preempt-rt system, if the kthread_prio is not set, it prio is 1. > > > > the boost kthreads can preempt almost rt task, It will affect > > > > the real-time performance of some user rt tasks. In preempt-rt systems, > > > > in most scenarios, this kthread_prio will be configured. > > > > > > > >Just following up... These questions might have been answered, but > > > >I am not seeing those answers right off-hand. > > > > > > > >Is the grace-period latency effect of choosing not to boost high-priority > > > >tasks visible at the system level in any actual workload? > > > > > > > >Suppose that a SCHED_DEADLINE task has exhausted its time quantum, > > > >and has thus been preempted within an RCU read-side critical section. > > > >Can priority boosting from a SCHED_FIFO prio-1 task cause it to start > > > >running? > > > > > > > >Do delays in RCU priority boosting cause excessive grace-period > > > >latencies on real workloads, even when all the to-be-boosted > > > >tasks are SCHED_OTHER? > > > > > > > >Thoughts? > > > > > > I have tested this modification these days, I originally planned to generate a Kconfig option to control > > > whether to skip tasks with higher priority than boost kthreads. but it doesn't seem necessary > > > because I find it's optimization is not particularly > > > obvious in the actual scene, I find that tasks with higher priority than boost kthreads > > > will quickly exit the rcu critical area , even if be preempted in the rcu critical area. > > > sorry for the noise. > > > > Thank you for getting back with this information, and no need to > > apologize. We all get excited about a potential change from time to time. > > Part of us maintainers' jobs is to ask hard questions when that appears > > to be happening. ;-) > > > > If you have continued interest in this area, it would be good to keep > > looking. After all, neither RCU expedited grace periods nor RCU priority > > boosting were designed with these new use cases in mind, so it is quite > > likely that there is a useful change to be made in there somewhere. > > > > You see, RCU expedited grace periods were designed for throughput rather > > than latency. The original use case was an old networking API that > > needed to wait for a grace period on each and every one of a series of > > some tens of thousands of system calls. If one or two of those system > > calls took a few hundred milliseconds, but the rest completed in less than > > a millisecond, no harm done. (Yes, there are now newer APIs that allow > > many changes to be made with only the one grace-period wait. But the > > kernel must continue to support the old API: Never Break Userspace.) > > > > For its part, RCU priority boosting was originally designed for > > debuggging. The point was to avoid OOMing the system when someone > > misconfigured their application's real-time priorities. As you know, > > such misconfiguration can easily prevent low-priority RCU readers from > > ever completing. > > > > So it is reasonably likely that some change or another is needed. After > > all, new use cases require new functionality and new fixes. The trick > > is figuring out which change makes sense amongst the huge group of other > > possible changes that each add much more complexity than improvement. > > But part of the process of finding that change that makes sense is trying > > out quite a few changes that don't help all that much. ;-) > > > Sorry for the late response, but i think i should comment on it since i > have tried to simulate and test this patch on Android device. Basically > we do have RT tasks in Android and i do not see that the patch that is > in question makes any difference. Actually i was not able to trigger its > functionality at all. > > >From the other hand, i have tried to simulate it making an RT environment > with SCHED_FIFO tasks and some synchronize_rcu_expedited() users. Indeed > i can trigger it but it is very specific env. and number of triggering or > tasks bypassing(high prio) is almost zero. Thank you both! I will set this aside for the time being. I am sure that further adjustments will be needed, but time will tell. Thanx, Paul