On Fri, Nov 20, 2020 at 06:20:06PM +0000, Christopher Lameter wrote: > On Tue, 17 Nov 2020, Marcelo Tosatti wrote: > > > > So what we would need would be something like a sysctl that puts the > > > system into a quiet state by completing all workqueue items. Idle all > > > subsystems that need it and put the cpu into NOHZ mode. > > > > Are you suggesting that instead of a specific file to control vmstat > > workqueue only, a more generic sysctl could be used? > > Yes. Introduce a sysctl to quiet down the system. Clean caches that will > trigger kernel threads and whatever else is pending on that processor. > > > About NOHZ mode: the CPU should enter NOHZ automatically as soon as > > there is a single thread running, so unclear why that would be needed. > > There are typically pending actions that still trigger interruptions. > > If you would immediately quiet down the system if there is only one thread > runnable then you would compromise system performance through frequent > counter folding and cache cleaning etc. Christopher, Decided to switch to prctl interface, and then it starts to become similar to "task mode isolation" patchset API. In addition to quiescing pending activities on the CPU, it would also be useful to assign a per-task attribute (which is then assigned to a per-CPU attribute), indicating whether that CPU is running an isolated task or not. This per-CPU attribute can be used to, for example, return -EBUSY from ring_buffer_resize() (or any other IPI generating activity which can return an error to userspace). So rather than: prctl(PR_QUIESCE_CPU) (current interface, similar to initial message on the thread but with prctl rather than sysfs) To be called before real time loop, one would have: prctl(PR_SET_TASK_ISOLATION, ISOLATION_ENABLE) [1] real time loop prctl(PR_SET_TASK_ISOLATION, ISOLATION_DISABLE) (with the attribute also being cleared on task exit). The general description would be: "Set task isolated mode for a given task, returning an error if the task is not pinned to a single CPU. In this mode, the kernel will avoid interruptions to isolated CPUs when possible." Any objections against such an interface ? [1] perhaps a name that does not conflict with "task mode" patchset is a better idea.