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 D2EF1C4332F for ; Wed, 14 Dec 2022 12:49:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 585928E0003; Wed, 14 Dec 2022 07:49:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 535068E0002; Wed, 14 Dec 2022 07:49:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3FC968E0003; Wed, 14 Dec 2022 07:49:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 31AE38E0002 for ; Wed, 14 Dec 2022 07:49:32 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 0CB76A05D0 for ; Wed, 14 Dec 2022 12:49:32 +0000 (UTC) X-FDA: 80240892984.07.27694E0 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf10.hostedemail.com (Postfix) with ESMTP id 73C89C0016 for ; Wed, 14 Dec 2022 12:49:30 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=uUap6aiH; spf=pass (imf10.hostedemail.com: domain of frederic@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=frederic@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1671022170; 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=CwZmnlPNJ6yqfr6x5BfrtcGawsn++GtMYc9GmXRWagI=; b=cHse8lCoyedncbm7lrNgc8Z25ZHnVKAcN7qaJ5t17D0OtRjxhvkcatSv0f7A5PuDnOLaNi XK/2jKOs11g4Dc9Ju7w5dKR7yzsvc+B/V68uFbFLlLhYZPjLPCXOYq3R8cr4mZOnND96Vb 8GcCqPAQAM0ARYP5fGvI/winykyQE6c= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=uUap6aiH; spf=pass (imf10.hostedemail.com: domain of frederic@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=frederic@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1671022170; a=rsa-sha256; cv=none; b=EOEUhyorQFe7gnlASRGa0i6hAilCVs0E6YPqeY6fqgmic5Kntz52MKiCU9wIm3hQqDsKVE TA6R8kg2Ca8MN/4OvXbaSC0gzz8HEtubuUBdlmYs0gbV9OZcH6VY7iJOLM8KhH2CaIrmYg /la5g7qB2xZuKCn8PRh9MhlrZxl9rak= 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 4D4F2619C8; Wed, 14 Dec 2022 12:49:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 371E5C433D2; Wed, 14 Dec 2022 12:49:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671022168; bh=MfURZ9LBGJIdU91BwgSvPBsaxxo8gfXFc4ZKjgaELJs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uUap6aiHDZvgbDfx3ZAuiCMW7MxWYq/v3Z7YS+Tpg6e0QdJsDwtQC0E4X+aBSUARX ZuckVeOGUZY1KbnSKt1riHxPHeUqGrvvdA7VWreYeCBPzgfiYIPHA9uDwtFHmakAfX pDN6ReDJycypdCrZgO9GlNCZ5MhJDAwMQDRW6r+3ef+yWwkQFh5HEem6Q7KE9onz1V dOjDre9So8BJTN+Op/fxGSIRrB4nbIDmMWaLS+hgcfqJuXviaayipf/jvy7nefNv0a 0YdlWYPcUCnTZwj+fh80mvY/46CqwUPKMO+BJ+hsAU5FVomY0yEqb7hoe5k6Rr9tVb UKDHoVeLCdsyQ== Date: Wed, 14 Dec 2022 13:49:25 +0100 From: Frederic Weisbecker To: Marcelo Tosatti Cc: atomlin@redhat.com, cl@linux.com, tglx@linutronix.de, mingo@kernel.org, peterz@infradead.org, pauld@redhat.com, neelx@redhat.com, oleksandr@natalenko.name, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v9 4/5] tick/nohz_full: Ensure quiet_vmstat() is called on exit to user-mode when the idle tick is stopped Message-ID: <20221214124925.GB1925147@lothringen> References: <20221206161826.698593151@redhat.com> <20221206162416.509808578@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221206162416.509808578@redhat.com> X-Rspamd-Queue-Id: 73C89C0016 X-Stat-Signature: tabzkwxh34re6oeezai6ow9i7ukjk7zk X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1671022170-826389 X-HE-Meta: U2FsdGVkX1+gfsE9HGKvLxBW6EVfIcckgwkdxUahr6INVVNlBas2DpveRt7x8gncTusWb15AedchiYHBKVu57Ro5r3lF5MgDuv3VFfQhJ4ugqxmhiRRgb9TjfoWJ81GO8ef4cc6+qLPkv7kkDjgsLQbOjuHjeikvV7nSmziZMO1Y3qAahAS5iFpklUoRhEAGYjT3X1uEIqNR2C8S7QtcDu8YtgbdKV2/Msh2BG1q+LEBOhlsqhapcY/wfdni4ewB0p8WKFFrk0UVCaYwYmILN6hL9E20r7AhFePJrtdOe4rIf5vPRSWD2dSsMms21+ATuCjbsDMocvJOgOfWDgXOCbzK9UpUy1iwD4lBpTZiL9iHjebUtlZFhV7k1sG/3fAa5hk+h0t7By3wb9VggmvXolWD8dwu43Zh5QgRciZ6Cddg4OFtLaQYLjFcRHuEJCUHDJ+xYIXZvWlF9OA/kGbZbeg3un/ILQ1fj5ZcjMjCFDpe9RdK1NpwAu8YcJxQCr3ie/4qDNccQS/C9J03gUsFXa+SJx5FjHKaHuzUv6NIBpIbxnnHd9EXTX8qOYNqOYH5TMipTOtPLPF3JpqR3l/NQ5nGcTX+oUlfiq/e7du+bSpqMnrwGne+0AyoVApfb6gVRbmw6lCkGrwLPSQGkmYMsH2oSKjyAlLeEYDttM1jtV4wPi/K4PIiU13VilNrCryub6FclJ3gSA5Vsh1cuhgBYnqC9viis/hw/6GMyEXDGnQYe5QhPVGmBSFEkH/EbQpbiWQ5zBGdHcZqz7y0nAshwzCRtdFqmMf/69OyFcQuZXH8c2gtSxvBpVty63+O3YLd4s7+N1l97qmKzBQg+3I3GJt3LZKabP4RKpBJBUQH1/zydfYrzgBrnAiWjbgy+Y2vE5kN7c3u445Fdl65Z4dl5/Kx0cGnaFrmGKppSt6pQ/72YtKE/7wIxjK7khTn//DIhVv1i3xeQLMyxQ5YVRk D/wb9LLi Khs5dPWplEVfyzhzxfa9UL9F3EOa1mLzOC9y2jf73IWUVRmrj2Ca2G23wn1Gf3NNTVZA9BnKt6eiWwzY= 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, Dec 06, 2022 at 01:18:30PM -0300, Marcelo Tosatti wrote: > From: Aaron Tomlin > > 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 This is missing your Signed-off-by: Also can you make this (and also the conditional vmstat_shepherd ignore nohz_full CPUs and also the in-place local arming) a Kconfig option perhaps? Something like CONFIG_FLUSH_WORK_ON_RESUME_USER (depend on NO_HZ_FULL). I'm using "WORK" instead of "VMSTAT" so that we can even add more stuff there later. This way I'll stop worrying about the potential HPC users who may not care about the occasional interrupt and prefer to have reasonably fast syscalls. Then after some time if nobody complains, we can remove the Kconfig entry. Thanks. > --- > include/linux/tick.h | 5 +++-- > kernel/time/tick-sched.c | 15 +++++++++++++++ > 2 files changed, 18 insertions(+), 2 deletions(-) > > Index: linux-2.6/include/linux/tick.h > =================================================================== > --- linux-2.6.orig/include/linux/tick.h > +++ linux-2.6/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 > > 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 > > 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 > 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 > Index: linux-2.6/kernel/time/tick-sched.c > =================================================================== > --- linux-2.6.orig/kernel/time/tick-sched.c > +++ linux-2.6/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(true); > + 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) > { > >