Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2813617rwi; Fri, 21 Oct 2022 08:12:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM49WvbmqmNDli2VTTLUniRdnreBgW3Ku3JRyH27MC50SYwb81vetWdKpfZrxxubzXDtUmQV X-Received: by 2002:a63:211a:0:b0:451:f444:3b55 with SMTP id h26-20020a63211a000000b00451f4443b55mr16067771pgh.60.1666365156824; Fri, 21 Oct 2022 08:12:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666365156; cv=none; d=google.com; s=arc-20160816; b=Sucb6ThbWmO2YRbAYLsCftWLxajSPCInjym3GACwBd9cfnQ7HkZvWaBbcBc1IqYHN9 0hbfAG2i3SXwFJeAzBv/zlVPQJOg/h78zo9ZIXt4rcRYvnAyXrn3el4y2I0MnrTnlV9d 633LFgRwh+qYYf61wQJvunCTcxnUJE/yEltCFY5Lw07F+h5Eolq77Q1QdDbu7WeIZ0m3 J/WcqsP/xpLo6EBz2sylB9kJpiD7ykb3Bu7RN2YCTudSHntl5lhgXD6sla51mWSaHWku y4U6jsWdvIU2CDJKbkE/ziPPWExSHuCZKDYd+7F+HjLYQTjZ6GrrccAYqPCQ1sP+yJRH 1vnA== 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:from:date:dkim-signature; bh=D0KMfunymbLODzyU54oZAeigOwXV0VyEP+VXJVW86Ig=; b=syYfA0W1nqKcYUrtHvPQnTuQbOMyTB8eaz6BRajzNjOoIyhvqtGl1ClajwhnBcV/+W YonaaRKxefDubWqTfG5oapmK+Dy5qBDXZaMK5TIGbt0Hynykt7dfuIK4nrjuex/iNn6R 0vkatfyu4paDGYTp5ZX0Aa0tM4NQw3MI1e9ASGiXZz6FaymMe6A9hOuTWHoQk0DnQ5qq NfdZaMNNQVXDt5sihjClFX+n0DQYfvQY9hiFDfVjylUdodupIxSPxHkOYRbu+5A0Ahny yOWOzYS0Z2cwIOOp4Na+TeC1vBijo0Pj6xqQKcTR/B+2TKVsSweCRgC8kC+hJzTS2pFt plDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gnyArhmC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s73-20020a632c4c000000b00434f938b9efsi25121716pgs.4.2022.10.21.08.12.24; Fri, 21 Oct 2022 08:12:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gnyArhmC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229868AbiJUOuz (ORCPT + 99 others); Fri, 21 Oct 2022 10:50:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230386AbiJUOu0 (ORCPT ); Fri, 21 Oct 2022 10:50:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E5097285B for ; Fri, 21 Oct 2022 07:50:23 -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 ams.source.kernel.org (Postfix) with ESMTPS id 1941AB82C38 for ; Fri, 21 Oct 2022 14:50:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67EF3C433C1; Fri, 21 Oct 2022 14:50:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666363820; bh=TQO+7YCcmwX5Ypn+TVh8IgVc3EYK8fr9049/M7h40nM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gnyArhmCk3HkvP208bggZCievQlUMH58blr6O/smRjn+IZVLv1Xg/NUycNe+9G5q+ j2uzlqWN7MNkDw94XuP5LI0swKptccokAXE2KAFHChetDu/IHkoHeelUUY58ahujI3 EkJ76WT7ownhhrXtRhSA1oL9rVmh6PUg0ZQcyl1ByVhJ/V3q4XHvHKXI0HlLPL0WtQ HT8Buvijn+PdCYLzbBllBgtub9/c0qu/rTnMP46AMmedJ1kD5LhLqxyc/lITm8gkhO C9EH2kxF3LYwEPCI4u7mVHvNk2LOObYNOzPHCG4qrPtCSPXfb66wr8g1bjlF2FPXNO /6vUbzMqgptvQ== Date: Fri, 21 Oct 2022 16:50:17 +0200 From: Frederic Weisbecker To: Rafael Folco Cc: Aaron Tomlin , mtosatti@redhat.com, cl@linux.com, tglx@linutronix.de, mingo@kernel.org, peterz@infradead.org, pauld@redhat.com, neelx@redhat.com, oleksandr@natalenko.name, atomlin@atomlin.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v8 4/5] tick/nohz_full: Ensure quiet_vmstat() is called on exit to user-mode when the idle tick is stopped Message-ID: <20221021145017.GA1265180@lothringen> References: <20220924152227.819815-1-atomlin@redhat.com> <20220924152227.819815-5-atomlin@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Tue, Sep 27, 2022 at 01:17:02PM -0300, Rafael Folco wrote: > Tested this patch w/ nohz_full setup and oslat 8h run on isolated cpus, max > latency is 7us versus 15us without the patch. > Thanks. What about the added overhead upon user enter? That is my main worry. For people who want nohz_full for lowest latency (or rather lowest noise) then it's a good add. But what if some people want to use nohz_full for HPC and prefer faster syscalls over avoiding an interrupt once in a while? (although arguably I never heard from users of such workloads...) Thanks. > > On Mon, Sep 26, 2022 at 8:02 PM Aaron Tomlin wrote: > > > This patch ensures CPU-specific vmstat differentials do not remain > > when the scheduling-tick is stopped and before exiting to user-mode > > in the context of nohz_full only. > > > > A trivial test program was used to determine the impact of the proposed > > changes and under vanilla. The mlock(2) and munlock(2) system calls was > > used solely to modify vmstat item 'NR_MLOCK'. The following is an average > > count of CPU-cycles across the aforementioned system calls: > > > > Vanilla Modified > > > > Cycles per syscall 8461 8690 (+2.6%) > > > > Signed-off-by: Aaron Tomlin > > --- > > include/linux/tick.h | 5 +++-- > > kernel/time/tick-sched.c | 15 +++++++++++++++ > > 2 files changed, 18 insertions(+), 2 deletions(-) > > > > diff --git a/include/linux/tick.h b/include/linux/tick.h > > index bfd571f18cfd..a2bbd6d32e33 100644 > > --- a/include/linux/tick.h > > +++ b/include/linux/tick.h > > @@ -11,7 +11,6 @@ > > #include > > #include > > #include > > -#include > > > > #ifdef CONFIG_GENERIC_CLOCKEVENTS > > extern void __init tick_init(void); > > @@ -272,6 +271,7 @@ static inline void tick_dep_clear_signal(struct > > signal_struct *signal, > > > > extern void tick_nohz_full_kick_cpu(int cpu); > > extern void __tick_nohz_task_switch(void); > > +void __tick_nohz_user_enter_prepare(void); > > extern void __init tick_nohz_full_setup(cpumask_var_t cpumask); > > #else > > static inline bool tick_nohz_full_enabled(void) { return false; } > > @@ -296,6 +296,7 @@ static inline void tick_dep_clear_signal(struct > > signal_struct *signal, > > > > static inline void tick_nohz_full_kick_cpu(int cpu) { } > > static inline void __tick_nohz_task_switch(void) { } > > +static inline void __tick_nohz_user_enter_prepare(void) { } > > static inline void tick_nohz_full_setup(cpumask_var_t cpumask) { } > > #endif > > > > @@ -308,7 +309,7 @@ static inline void tick_nohz_task_switch(void) > > static inline void tick_nohz_user_enter_prepare(void) > > { > > if (tick_nohz_full_cpu(smp_processor_id())) > > - rcu_nocb_flush_deferred_wakeup(); > > + __tick_nohz_user_enter_prepare(); > > } > > > > #endif > > diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c > > index b0e3c9205946..634cd0fac267 100644 > > --- a/kernel/time/tick-sched.c > > +++ b/kernel/time/tick-sched.c > > @@ -26,6 +26,7 @@ > > #include > > #include > > #include > > +#include > > > > #include > > > > @@ -519,6 +520,20 @@ void __tick_nohz_task_switch(void) > > } > > } > > > > +void __tick_nohz_user_enter_prepare(void) > > +{ > > + struct tick_sched *ts; > > + > > + if (tick_nohz_full_cpu(smp_processor_id())) { > > + ts = this_cpu_ptr(&tick_cpu_sched); > > + > > + if (ts->tick_stopped) > > + quiet_vmstat(); > > + rcu_nocb_flush_deferred_wakeup(); > > + } > > +} > > +EXPORT_SYMBOL_GPL(__tick_nohz_user_enter_prepare); > > + > > /* Get the boot-time nohz CPU list from the kernel parameters. */ > > void __init tick_nohz_full_setup(cpumask_var_t cpumask) > > { > > -- > > 2.37.1 > > > > > > > > -- > Folco