Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp3088032rdb; Mon, 4 Dec 2023 17:04:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IEJylp12s25uk98zvRHD/q4FZKv7R2qWs500rkGBtoj0HIA+HmDoqWykW83PYsj52G2kmH5 X-Received: by 2002:a05:620a:4089:b0:77f:5ac:1764 with SMTP id f9-20020a05620a408900b0077f05ac1764mr606460qko.65.1701738248245; Mon, 04 Dec 2023 17:04:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701738248; cv=none; d=google.com; s=arc-20160816; b=XyuMiHaVsbTpjDGVpJpBdixa+bWmQdSKD/fRygO7bpHNIejf6g4sA4OD/h+4uc9So0 ymugVRZzRmAvmG69YzCbRtg8OEWEeJIHaF7vtNj4Q18bX1XYT5VROWNk8cuvZ2KIt6pm zL8ksZEGt73y7sOkivmZXRCtWZl9Gb8RZCL4qUbvy9V5d86a+bsPXKuP3Hf7n4tfp1HD CYpqKKG3m+WZoJaDFfkuV6g8Yf6IIAxV5wwsunwDt5Xe4XavTY/moC9bwe+3Ph+Dwkds ZvvkT/5DvK76si/wkXPu4RngF+yHQZ7vMu6BOwOCozbwBg+cwPdsJO9WHHwVtk9dtvF0 sJQA== 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=2F6oYrzx0QWGqJt/iP5MUcXqDVZI2ZY9X0N2ftYuqsI=; fh=sN10T1waST09yjOs7kXOwZjGzeTyy3hDKK0bVQCnlwE=; b=olorXtIDSLUsJsuSZWi8rEya97pJAqM2oOap4fLfnIsX+grW/3B1kuaFxFF+sJlMBD Ofe2Choz25J1EV5W+TVcItauL2U4CVOBlnTXvAFx7Wh0+riVilcduTW5lYvVkLa9OrUz c9UuhncfMrfl+AE1MoyvXnn38aV2k9ucpflVHOMdK2HmQae/8CIjqMDjBdS7YVyVhgO1 nxulCb/KmyYZPhsTQNaFl9MOp8LQf0pyIiBj7y3gIccEmOAlSPXeK5FA3PZOFVne73kD su4wlRT3BK4wziSTmS6mTpPYiFWAtc3VYFDb1gffpioX12K3tuSoit41YHaNfxWSVeMA 5o/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FL4NuMjy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id w21-20020a05620a445500b0077d72b6ab70si11104063qkp.355.2023.12.04.17.04.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 17:04:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FL4NuMjy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 9B4AB802209D; Mon, 4 Dec 2023 17:04:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229742AbjLEBDu (ORCPT + 99 others); Mon, 4 Dec 2023 20:03:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229575AbjLEBDt (ORCPT ); Mon, 4 Dec 2023 20:03:49 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22922A4 for ; Mon, 4 Dec 2023 17:03:56 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE6F1C433C7; Tue, 5 Dec 2023 01:03:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701738235; bh=Bs9k/6LoUODYcT83sb8TNsFZmO2JrEzRWlVXH0bC4/8=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=FL4NuMjyUEvhEfw6zbKZYj5RExoInuV0ePirGfgE7E7M4QrqD+0xVK1990Nx5iEFe 7nMA6P03QxPN6J7poviGPulyznm4U6sYJ8Z7IIkiR3aYz4SpgWssQgaBp9PfRqFddh e+7F+a7pDXD9mqMIvmLt6ndZBIPnOTjlLbqeN5R+RsAN19JgHxi9eMN7wCgJayN72z S2+hAutD5D6aM51vYrj/7m5iqsZE4WdoImSPurfZ9dKrz1iq83m9KHbn9t6IPRr7VF P/6Bku8Qy3k7I5J7MaLPL5QD1kVNoDeMsipKuKi8UNJYjFYtsYPiYK/Oz1l8gvAuSj CuH9XQ/wmz7Kw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 44B48CE1147; Mon, 4 Dec 2023 17:03:55 -0800 (PST) Date: Mon, 4 Dec 2023 17:03:55 -0800 From: "Paul E. McKenney" To: Ankur Arora Cc: Thomas Gleixner , Steven Rostedt , linux-kernel@vger.kernel.org, peterz@infradead.org, torvalds@linux-foundation.org, linux-mm@kvack.org, x86@kernel.org, akpm@linux-foundation.org, luto@kernel.org, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, willy@infradead.org, mgorman@suse.de, jon.grimm@amd.com, bharata@amd.com, raghavendra.kt@amd.com, boris.ostrovsky@oracle.com, konrad.wilk@oracle.com, jgross@suse.com, andrew.cooper3@citrix.com, mingo@kernel.org, bristot@kernel.org, mathieu.desnoyers@efficios.com, geert@linux-m68k.org, glaubitz@physik.fu-berlin.de, anton.ivanov@cambridgegreys.com, mattst88@gmail.com, krypton@ulrich-teichert.org, David.Laight@aculab.com, richard@nod.at, mjguzik@gmail.com, Simon Horman , Julian Anastasov , Alexei Starovoitov , Daniel Borkmann Subject: Re: [RFC PATCH 47/86] rcu: select PREEMPT_RCU if PREEMPT Message-ID: Reply-To: paulmck@kernel.org References: <87wmu2ywrk.ffs@tglx> <87plztvig2.fsf@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87plztvig2.fsf@oracle.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,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 morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 04 Dec 2023 17:04:04 -0800 (PST) On Tue, Nov 28, 2023 at 10:30:53AM -0800, Ankur Arora wrote: > > Thomas Gleixner writes: > > > Paul! > > > > On Tue, Nov 21 2023 at 07:19, Paul E. McKenney wrote: > >> On Tue, Nov 21, 2023 at 10:00:59AM -0500, Steven Rostedt wrote: > >>> Right now, the use of cond_resched() is basically a whack-a-mole game where > >>> we need to whack all the mole loops with the cond_resched() hammer. As > >>> Thomas said, this is backwards. It makes more sense to just not preempt in > >>> areas that can cause pain (like holding a mutex or in an RCU critical > >>> section), but still have the general kernel be fully preemptable. > >> > >> Which is quite true, but that whack-a-mole game can be ended without > >> getting rid of build-time selection of the preemption model. Also, > >> that whack-a-mole game can be ended without eliminating all calls to > >> cond_resched(). > > > > Which calls to cond_resched() should not be eliminated? > > > > They all suck and keeping some of them is just counterproductive as > > again people will sprinkle them all over the place for the very wrong > > reasons. > > And, as Thomas alludes to here, cond_resched() is not always cost free. > Needing to call cond_resched() forces us to restructure hot paths in > ways that results in worse performance/complex code. > > One example is clear_huge_page(), where removing the need to call > cond_resched() every once in a while allows the processor to optimize > differently. > > *Milan* mm/clear_huge_page x86/clear_huge_page change > (GB/s) (GB/s) > > pg-sz=2MB 14.55 19.29 +32.5% > pg-sz=1GB 19.34 49.60 +156.4% > > (See https://lore.kernel.org/all/20230830184958.2333078-1-ankur.a.arora@oracle.com/) > > And, that's one of the simpler examples from mm. We do this kind of arbitrary > batching all over the place. > > Or see the filemap_read() example that Linus gives here: > https://lore.kernel.org/lkml/CAHk-=whpYjm_AizQij6XEfTd7xvGjrVCx5gzHcHm=2Xijt+Kyg@mail.gmail.com/#t I already agree that some cond_resched() calls can cause difficulties. But that is not the same as proving that they *all* should be removed. Thanx, Paul