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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F851C433FE for ; Fri, 21 Oct 2022 14:50:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0BB148E0002; Fri, 21 Oct 2022 10:50:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 06BB68E0001; Fri, 21 Oct 2022 10:50:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E9CA38E0002; Fri, 21 Oct 2022 10:50:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id DAE6F8E0001 for ; Fri, 21 Oct 2022 10:50:22 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id A24651202D8 for ; Fri, 21 Oct 2022 14:50:22 +0000 (UTC) X-FDA: 80045242284.26.68DA6C0 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf14.hostedemail.com (Postfix) with ESMTP id 4D879100028 for ; Fri, 21 Oct 2022 14:50:22 +0000 (UTC) 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 5738D60A57; Fri, 21 Oct 2022 14:50:21 +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: ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1666363822; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=D0KMfunymbLODzyU54oZAeigOwXV0VyEP+VXJVW86Ig=; b=z9zcc8vHZxLJfFVmOkf+er1Q/xJnyrUWSO+hn3eKuhTsliDjFzFns8zjQw/tnhIJ/QP3ng dPW7ay4U7Vrcke465igyI/H22UVM2Fu5ltjgb4APWLr4NAZHCRS6HRdkyKpUQHqyPYGr2J jiBAcDn2fhy22Bw2PiDzfn6EfR2b7Fs= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=gnyArhmC; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf14.hostedemail.com: domain of frederic@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=frederic@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666363822; a=rsa-sha256; cv=none; b=FpzD5tsIXEO/begIbwEr19MMsFuXgYuj6we6J5pAJGncMh3rf/t9FDktv2unsDGqno1hnZ iLIJvrSMm+A4F9suOto4JaVQgLhRJR0t1yVf1p97nDfqNa1NQxu/SlWC+xhLzx8ep5BL0+ HXZ7KqmLTHYR42yAXM7UZp1ZC2S0ezQ= X-Rspam-User: X-Rspamd-Queue-Id: 4D879100028 X-Stat-Signature: edw7xtuw6iihtijraf3z376kbzdxhxfo Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=gnyArhmC; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf14.hostedemail.com: domain of frederic@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=frederic@kernel.org X-Rspamd-Server: rspam07 X-HE-Tag: 1666363822-615630 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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