Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp5244363iob; Mon, 9 May 2022 11:48:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBdOLb4E0VwrJCfksScIVFIaF6l2E9LcX6XDPYyxgq0SbraB8vjX0KeCEsRo5TvMzaSuq9 X-Received: by 2002:a05:622a:13d1:b0:2f3:ca31:2200 with SMTP id p17-20020a05622a13d100b002f3ca312200mr15011868qtk.348.1652122139485; Mon, 09 May 2022 11:48:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652122139; cv=none; d=google.com; s=arc-20160816; b=zRt9ORcPNl553BMGIFxFFyyZpHtZRgLd/feU3PGRbY8tWJZcxyv47iwEp7nedsS64Y w2VIJhvfIcpc9XibzS4ZlifUgGlXmkLkWxucbf04fyEyfJVSlZAQT70UgeoXl7zZAwxa 6AUAqr1Gddqxg4YoDbS1q3Rg1J4uMY1FdybzsjftpV/6biUUvDX6uaWJejvvWkAQUCKH E/YVjjwyQjyDVqHpVKGgLjisLEwIHLqlu5097xS59HQ2D72R6GU30APhmKZEzO5LAprz 4m+HT/6NuvHiJE8c80MNtEKPb2m/93KSY9gB9pxV90Egb9VGx53QLiiB1uKtFpSlNibx V37w== 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:message-id:subject:cc:to:date:from:dkim-signature; bh=5x0jMgOGKfQGL1jUJac1rDSNC7TdvExYknM3mjKrJkE=; b=nw6/TfslIKqB3gsKGoBT1sslF6Uiv+Cef8+SK2kSlyKAwfeFsGk+a3dbFOFX3brNmw vgruV+zAPzqVeObaZw3IPqFpD/wllOk3D0irICfzZpTyrvLSC4HgMLxteT5svLXHJIi3 zNDLYnowZESf8ep+h5uvBoJ0LcEoYMaqv00WPHPNcBX2gfYt9xU0JRlTl5tfTEYspgMX sdldehfzofqIWDdONe96YpEAMxJBXdiAJo3UG+m4RJv5CNufip6l3sMKv64WufZ2PK1b J8cOCq5heF5iq6y1zAJUCA5oyR1xI4hphTK8lVzjbrGhlDMPowMpv99Q+18Q/O+zCypJ p8sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=dy6i0MLq; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id i144-20020a379f96000000b0069f870496e8si6770383qke.113.2022.05.09.11.48.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 11:48:59 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=dy6i0MLq; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D2F2A1882E6; Mon, 9 May 2022 11:43:47 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240308AbiEISrf (ORCPT + 99 others); Mon, 9 May 2022 14:47:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240291AbiEISrd (ORCPT ); Mon, 9 May 2022 14:47:33 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A6091868CB; Mon, 9 May 2022 11:43:38 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id w19so25367489lfu.11; Mon, 09 May 2022 11:43:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=5x0jMgOGKfQGL1jUJac1rDSNC7TdvExYknM3mjKrJkE=; b=dy6i0MLqrzBMsT47ZyLi04b2rWFzlfrf8ZKL3bsyOPDJ4qMEBLAx6euRK2QrhjYLdF n4vvs14SAuyFjQ3zuO7HwnKsmFml1mSMRr1fXHxd0Hn04i70A263DJQZY1ijqIkbfc0R 7Sy2HymKsJqzyi1tKHNtQSDueKz327Rc33vlqjDiPDPrI/ouhwoaF4/6oCAcQH9frPTE E713kkNpstZVuopsKkXGlmGTuJ2RVGXcVk4mMY7BwMlbwFp7XXs3HjndIygt2cC08qqe DJ5qD2df1JLtB4uJJgNcL+OsYZno67ZYKgPFRhX3LhXXoxU8JEHQUvnyz4MLkFAtxNQN ekXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=5x0jMgOGKfQGL1jUJac1rDSNC7TdvExYknM3mjKrJkE=; b=KwvhwuWyc0p+purPZiQQDOdilWf5tPLIxd+oys/ZVVdRHlstbSH3gX0ltC+f/uDvQh /8Kmfjz7ljb8J2Jh/Xb+R2MNgrbrv9jq34VsdomBj3DB6UX6VWMveirRSVqkgS8qs4hj xnHgVTKCImhSlvxy3b2uVaTrFwybCa4SuPauXi/BCpEz4vGGg0TwQh5P3pEDPHT1N0LW J33CdxVSRnUfusa5b4eWQ/wLJaPkv8eMExQbgn8mgXPiSlOGGa97Krwc9t3xil+iVI92 6U+/OaZOe9ixNGWEnNKL2pyf0hA1YQrWQ4+XV0ZDqlz4acsL2+Z7NERkZfy1vnuIeaLX /R1w== X-Gm-Message-State: AOAM532Al9pTAWzwJAQYrVLzaIhaSlFpyjRcjqZRCGSIuYbVsniRB7EI IpsfzjtrSq2kduskzgJvYX8= X-Received: by 2002:ac2:5ecc:0:b0:472:3c01:9a2e with SMTP id d12-20020ac25ecc000000b004723c019a2emr13396976lfq.245.1652121816325; Mon, 09 May 2022 11:43:36 -0700 (PDT) Received: from pc638.lan ([155.137.26.201]) by smtp.gmail.com with ESMTPSA id u12-20020ac243cc000000b0047255d211a1sm2019933lfl.208.2022.05.09.11.43.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 11:43:35 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Mon, 9 May 2022 20:43:33 +0200 To: "Paul E. McKenney" Cc: Uladzislau Rezki , Joel Fernandes , Steven Rostedt , Alison Chaiken , Sebastian Andrzej Siewior , LKML , RCU , Frederic Weisbecker , Neeraj Upadhyay , Oleksiy Avramchenko Subject: Re: [PATCH] rcu/nocb: Add an option to ON/OFF an offloading from RT context Message-ID: References: <20220507223247.GK1790663@paulmck-ThinkPad-P17-Gen-1> <20220508213222.GL1790663@paulmck-ThinkPad-P17-Gen-1> <20220509033740.GM1790663@paulmck-ThinkPad-P17-Gen-1> <20220509181417.GO1790663@paulmck-ThinkPad-P17-Gen-1> <20220509183934.GQ1790663@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220509183934.GQ1790663@paulmck-ThinkPad-P17-Gen-1> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Mon, May 09, 2022 at 08:28:26PM +0200, Uladzislau Rezki wrote: > > > On Mon, May 09, 2022 at 01:17:00PM -0400, Joel Fernandes wrote: > > > > On Sun, May 8, 2022 at 11:37 PM Paul E. McKenney wrote: > > > > > > > > > > On Sun, May 08, 2022 at 08:17:49PM -0400, Joel Fernandes wrote: > > > > > > On Sun, May 8, 2022 at 5:32 PM Paul E. McKenney wrote: > > > > [...] > > > > > > > > Also, I think it is wrong to assume that a certain kind of system will > > > > > > > > always have a certain number of callbacks to process at a time. That > > > > > > > > seems prone to poor design due to assumptions which may not always be > > > > > > > > true. > > > > > > > > > > > > > > Who was assuming that? Uladzislau was measuring rather than assuming, > > > > > > > if that was what you were getting at. Or if you are thinking about > > > > > > > things like qhimark, your point is exactly why there is both a default > > > > > > > (which has worked quite well for a very long time) and the ability to > > > > > > > adjust based on the needs of your specific system. > > > > > > > > > > > > I was merely saying that based on measurements make assumptions, but > > > > > > in the real world the assumption may not be true, then everything > > > > > > falls apart. Instead I feel, callback threads should be RT only if 1. > > > > > > As you mentioned, the time based thing. 2. If the CB list is long and > > > > > > there's lot of processing. But instead, if it is made a CONFIG option, > > > > > > then that forces a fixed behavior which may fall apart in the real > > > > > > world. I think adding more CONFIGs and special cases is more complex > > > > > > but that's my opinion. > > > > > > > > > > Again, exactly what problem are you trying to solve? > > > > > > > > > > From what I can see, Uladzislau's issue can be addressed by statically > > > > > setting the rcuo kthreads to SCHED_OTHER at boot time. The discussion > > > > > is on exactly how RCU is to be informed of this, at kernel build time. > > > > > > > > > > > > > Can we not have 2 sets of RCU offload threads, one which operate at RT > > > > > > > > and only process few callbacks at a time, while another which is the > > > > > > > > lower priority CFS offload thread - executes whenever there is a lot > > > > > > > > of CBs pending? Just a thought. > > > > > > > > > > > > > > How about if we start by solving the problems we know that we have? > > > > > > > > > > > > I don't know why you would say that, because we are talking about > > > > > > solving the specific problem Vlad's patch addresses, not random > > > > > > problems. Which is that, Android wants to run expedited GPs, but when > > > > > > the callback list is large, the RT nocb thread can starve other > > > > > > things. Did I misunderstand the patch? If so, sorry about that but > > > > > > that's what my email was discussing. i.e. running of CBs in RT > > > > > > threads. I suck at writing well as I clearly miscommunicated. > > > > > > > > > > OK. > > > > > > > > > > Why do you believe that this needs anything other than small adjustments > > > > > the defaults of existing Kconfig options? Or am I completely missing > > > > > the point of your proposal? > > > > > > > > > > > > > Otherwise, I feel like we might be again proliferating CONFIG options > > > > > > > > and increasing burden on the user to get it the CONFIG right. > > > > > > > > > > > > > > I bet that we will solve this without adding any new Kconfig options. > > > > > > > And I bet that the burden is at worst on the device designer, not on > > > > > > > the user. Plus it is entirely possible that there might be a way to > > > > > > > automatically configure things to handle what we know about today, > > > > > > > again without adding Kconfig options. > > > > > > > > > > > > Yes, agreed. > > > > > > > > > > If I change my last sentence to read as follows, are we still in > > > > > agreement? > > > > > > > > > > Plus it is entirely possible that there might be a way to > > > > > automatically configure things to handle what we know about today, > > > > > again without adding Kconfig options and without changing runtime > > > > > code beyond that covered by Uladzislau's patch. > > > > > > > > Yes, actually the automatic configuration of things is what I meant, > > > > that's the "problem" I was referring to, where the system does the > > > > right thing for a broader range of systems, without requiring the > > > > users to find RCU issues and hand-tune them (that requires said users > > > > to have tracing and debugging skills and get lucky finding a problem). > > > > To be fair, I did not propose any solutions to such problems either, > > > > it is just some ideas. I don't like knobs too much and I don't trust > > > > users or system designers to get them right most of the time. > > > > > > > > In that sense, I don't think making rcuo threads run as RT or not > > > > (which this patch does) is really fixing the problems. In one case, > > > > you might have priority inversion, in another case you might cause > > > > starvation. Probably what is needed is best of both worlds. That said, > > > > I don't have better solutions right now than what I mentioned, which > > > > is to assign priorities to the callbacks themselves and run them in > > > > threads of different priorities. > > > > > > > > For the record, I am not against the patch or anything like that (and > > > > even if I was, I am not sure that it matters for merging :P) > > > > > > Fair enough! > > > > > > And for the record at this end, I would not be surprised if in 2032 > > > RCU offloaded callback invocation has sophisticated dynamic tuning of > > > priorities and much else besides. But one step at a time! ;-) > > > > > hh... It is hard to comment because i am a bit lost in this big conversation :) > > > > What i have got so far. Joel does not like adding extra *_CONFIG > > options, actually me too since it becomes more complicated thus > > it requires more specific attention from users. I prefer to make > > the code common but it is not possible sometimes to make it common, > > because we have different kind of kernels and workloads. > > > > >From the other hand the patch splits the BOOSTING logic into two peaces > > because driving the grace periods kthreads in RT priority is not a big > > issue because their run-times are short. Whereas running the "kthreads-callbacks" > > in the RT context can be long so we end up in throttled situation for > > other workloads. > > > > I see that Paul would like to keep it for CONFIG_PREEMPT_RT, because it > > was mainly designed for that kind of kernels. So we can align with Alison > > patch and her decision, so i do not see any issues. So far RT folk seems > > does not mind in having "callback-kthreads" as SCHED_FIFO :) > > > > Do you agree with start from keeping it ON for CONFIG_PREEMPT_RT conf. > > by default and OFF for other cases? > > Yes, please! > > This allows your current RCU_NOCB_CPU_CB_BOOST with something like > this in place of the "default n": > > default y if PREEMPT_RT > default n if !PREEMPT_RT > > There might be a simpler way of doing this, but this would work. > > Could you please send a v2 with the requested updates? > No problem, will send an updated version. -- Uladzislau Rezki