Skip to content

optionally perform deferred actions on return to userspace

Marcelo Tosatti lkml oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5sched: isolation: introduce quiesce_on_exit_to_usermode isolcpu flagsDocumentation/admin-guide/kernel-parameters.txt include/linux/sched/isolation.h kernel/sched/isolation.c+44 -00 replies
2/5common entry: add hook for isolation to __syscall_exit_to_user_mode_workkernel/entry/common.c+9 -00 replies
3/5mm: vmstat: optionally flush per-CPU vmstat counters on return to userspaceinclude/linux/vmstat.h kernel/entry/common.c kernel/sched/isolation.c +1 more+78 -03 replies
4/5mm: vmstat: move need_updatemm/vmstat.c+34 -340 replies
5/5mm: vmstat_refresh: avoid queueing work item if cpu stats are cleanmm/vmstat.c+34 -60 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [patch 0/5] optionally perform deferred actions on return to userspace

Changelog:

-v2: fix !CONFIG_SMP breakage (kernel robot)
switch option to generic "quiesce_on_exit_to_usermode"

Summary of what was discussed on -v1:

1) The additional hooks to performance sensitive callbacks in mm/vmstat.c are protected by a static key, therefore workloads which do not enable this should not be impacted.

2) People would prefer the prctl() interface, but as noted in the option documentation (patch 1), the code added by this patchset should be reused by the prctl() interface, and the isolcpus option can then be deprecated.

3) Nobody has any other bright ideas for ways to solve this that would make this patch series obsolete.

4) The isolcpus= interface should switch to a cpuset based interface.

---

The logic to disable vmstat worker thread, when entering nohz full, does not cover all scenarios. For example, it is possible for the following to happen:

1) enter nohz_full, which calls refresh_cpu_vm_stats, syncing the stats.
2) app runs mlock, which increases counters for mlock'ed pages.
3) start -RT loop

Since refresh_cpu_vm_stats from nohz_full logic can happen _before_ the mlock, vmstat shepherd can restart vmstat worker thread on the CPU in question.

To fix this, optionally quiesce deferred actions when returning to userspace, controllable by a new "quiesce_on_exit_to_usermode" isolcpus flag (default off).

See individual patches for details.