acrn-kernel/Documentation/accounting
Domenico Cerasuolo d5dca19776 sched/psi: Allow unprivileged polling of N*2s period
[ Upstream commit d82caa2735 ]

PSI offers 2 mechanisms to get information about a specific resource
pressure. One is reading from /proc/pressure/<resource>, which gives
average pressures aggregated every 2s. The other is creating a pollable
fd for a specific resource and cgroup.

The trigger creation requires CAP_SYS_RESOURCE, and gives the
possibility to pick specific time window and threshold, spawing an RT
thread to aggregate the data.

Systemd would like to provide containers the option to monitor pressure
on their own cgroup and sub-cgroups. For example, if systemd launches a
container that itself then launches services, the container should have
the ability to poll() for pressure in individual services. But neither
the container nor the services are privileged.

This patch implements a mechanism to allow unprivileged users to create
pressure triggers. The difference with privileged triggers creation is
that unprivileged ones must have a time window that's a multiple of 2s.
This is so that we can avoid unrestricted spawning of rt threads, and
use instead the same aggregation mechanism done for the averages, which
runs independently of any triggers.

Suggested-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Domenico Cerasuolo <cerasuolodomenico@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Link: https://lore.kernel.org/r/20230330105418.77061-5-cerasuolodomenico@gmail.com
Stable-dep-of: aff037078e ("sched/psi: use kernfs polling functions for PSI trigger polling")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-07-27 08:50:38 +02:00
..
cgroupstats.rst Documentation: Replace lkml.org links with lore 2021-01-11 12:47:38 -07:00
delay-accounting.rst filemap: make the accounting of thrashing more consistent 2022-09-26 19:46:06 -07:00
index.rst docs: add some documentation dirs to the driver-api book 2019-07-15 11:03:02 -03:00
psi.rst sched/psi: Allow unprivileged polling of N*2s period 2023-07-27 08:50:38 +02:00
taskstats-struct.rst docs: accounting: convert to ReST 2019-07-15 09:20:25 -03:00
taskstats.rst docs: accounting: convert to ReST 2019-07-15 09:20:25 -03:00