mbox series

[v5,0/2] tick/sched: Ensure quiet_vmstat() is called when the idle tick was stopped too

Message ID 20220801234258.134609-1-atomlin@redhat.com (mailing list archive)
Headers show
Series tick/sched: Ensure quiet_vmstat() is called when the idle tick was stopped too | expand

Message

Aaron Tomlin Aug. 1, 2022, 11:42 p.m. UTC
Hi Frederic and Marcelo,

I have incorporated an idea from Marcelo's patch [1] where a CPU-specific
variable is used to indicate if a vmstat differential/or imbalance is
present for a given CPU. So, at the appropriate time, vmstat processing can
be initiated. The hope is that this particular approach is "cheaper" when
compared to need_update() - used currently; in the context of nohz_full and
the scheduling-clock tick being stopped, we would now with this patch,
check if a CPU-specific vmstat imbalance is present before exiting
user-mode (see tick_nohz_user_enter_prepare()).

This trivial test program [2] was used to determine the somewhat impact
under vanilla and with the proposed changes; mlock(2) and munlock(2) was
used solely to modify vmstat item 'NR_MLOCK'. The following is an average
count of CPU-cycles across the aforementioned system calls and the idle
loop, respectively. I believe these results are negligible:

	  Modified		   |  		Vanilla
                                   |
  cycles per syscall: 7399         | 	cycles per syscall: 4150
  cycles per idle loop: 141048     |	cycles per idle loop: 144730
                                   |


Any feedback would be appreciated. Thanks.

Changes since v4 [3]:

 - Moved vmstat_dirty specific changes into a separate patch
   (Marcelo Tosatti)

Changes since v3 [4]:

 - Used EXPORT_SYMBOL() on tick_nohz_user_enter_prepare()
 - Replaced need_update()
 - Introduced CPU-specific variable namely vmstat_dirty
   and mark_vmstat_dirty()

[1]: https://lore.kernel.org/lkml/20220204173554.763888172@fedora.localdomain/
[2]: https://pastebin.com/8AtzSAuK
[3]: https://lore.kernel.org/lkml/20220621172207.1501641-1-atomlin@redhat.com/
[4]: https://lore.kernel.org/lkml/20220422193647.3808657-1-atomlin@redhat.com/


Aaron Tomlin (2):
  mm/vmstat: Use per cpu variable to track a vmstat discrepancy
  tick/sched: Ensure quiet_vmstat() is called when the idle tick was
    stopped too

 include/linux/tick.h     |  9 ++------
 kernel/time/tick-sched.c | 19 ++++++++++++++++-
 mm/vmstat.c              | 46 +++++++++++++---------------------------
 3 files changed, 35 insertions(+), 39 deletions(-)