From: Rafael Folco <rfolco@redhat.com>
To: Aaron Tomlin <atomlin@redhat.com>
Cc: frederic@kernel.org, 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
Date: Tue, 27 Sep 2022 13:17:02 -0300 [thread overview]
Message-ID: <CAOr2xH5DjEy7agHYx=5+4cr+OeJz52HUeUttkF9ueS8JHbQMFg@mail.gmail.com> (raw)
In-Reply-To: <20220924152227.819815-5-atomlin@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 3465 bytes --]
Tested this patch w/ nohz_full setup and oslat 8h run on isolated cpus, max
latency is 7us versus 15us without the patch.
Thanks.
On Mon, Sep 26, 2022 at 8:02 PM Aaron Tomlin <atomlin@redhat.com> 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 <atomlin@redhat.com>
> ---
> 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 <linux/context_tracking_state.h>
> #include <linux/cpumask.h>
> #include <linux/sched.h>
> -#include <linux/rcupdate.h>
>
> #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 <linux/posix-timers.h>
> #include <linux/context_tracking.h>
> #include <linux/mm.h>
> +#include <linux/rcupdate.h>
>
> #include <asm/irq_regs.h>
>
> @@ -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
[-- Attachment #2: Type: text/html, Size: 4439 bytes --]
next prev parent reply other threads:[~2022-09-27 16:17 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-24 15:22 [PATCH v8 0/5] Ensure quiet_vmstat() is called when the idle tick was stopped too Aaron Tomlin
2022-09-24 15:22 ` [PATCH v8 1/5] mm/vmstat: Add CPU-specific variable to track a vmstat discrepancy Aaron Tomlin
2022-09-24 15:22 ` [PATCH v8 2/5] mm/vmstat: Use vmstat_dirty to track CPU-specific vmstat discrepancies Aaron Tomlin
2022-10-01 14:55 ` kernel test robot
2022-09-24 15:22 ` [PATCH v8 3/5] mm/vmstat: Do not queue vmstat_update if tick is stopped Aaron Tomlin
2022-10-24 11:03 ` Frederic Weisbecker
2022-11-09 19:40 ` Marcelo Tosatti
2022-11-10 19:15 ` Marcelo Tosatti
2022-11-14 12:12 ` Frederic Weisbecker
2022-10-24 11:54 ` Frederic Weisbecker
2022-09-24 15:22 ` [PATCH v8 4/5] tick/nohz_full: Ensure quiet_vmstat() is called on exit to user-mode when the idle " Aaron Tomlin
2022-09-27 16:17 ` Rafael Folco [this message]
2022-09-29 8:22 ` Aaron Tomlin
2022-09-29 12:49 ` Rafael Folco
2022-10-21 14:50 ` Frederic Weisbecker
2022-11-10 19:14 ` Marcelo Tosatti
2022-09-24 15:24 ` [PATCH v8 5/5] tick/sched: Ensure quiet_vmstat() is called when the idle tick was stopped too Aaron Tomlin
2022-09-25 1:05 ` Hillf Danton
2022-09-26 9:20 ` Aaron Tomlin
2022-10-03 12:44 ` Hillf Danton
2022-10-12 12:41 ` Aaron Tomlin
2022-10-17 16:04 ` Marcelo Tosatti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAOr2xH5DjEy7agHYx=5+4cr+OeJz52HUeUttkF9ueS8JHbQMFg@mail.gmail.com' \
--to=rfolco@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=atomlin@atomlin.com \
--cc=atomlin@redhat.com \
--cc=cl@linux.com \
--cc=frederic@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mingo@kernel.org \
--cc=mtosatti@redhat.com \
--cc=neelx@redhat.com \
--cc=oleksandr@natalenko.name \
--cc=pauld@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox