On Tue, 17 Nov 2020, Matthew Wilcox 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. > > Why does it need to be something userspace does? It would seem reasonable > that the kernel could figure out for itself that it's about to start > this CPU operating in isolated mode and flush all the work first? The kernel holds objects for various purposes in caches just in case. And these objects are expired when they are considered cache cold. Similarly vmstat does not fold counters into the global ones just in case more things need to be locally counted in order to prevent contention on the global counters. The kernel cannot know that user space will not be using system calls but wants a quiet operating environment without interruptions for cache expiration and other things. The kernel can do all sorts of preventitive work to avoid deferred actions and create a OS noise free environment for the application.