[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250822013749.3268080-6-ynaffit@google.com>
Date: Thu, 21 Aug 2025 18:37:51 -0700
From: Tiffany Yang <ynaffit@...gle.com>
To: linux-kernel@...r.kernel.org
Cc: John Stultz <jstultz@...gle.com>, Thomas Gleixner <tglx@...utronix.de>,
Stephen Boyd <sboyd@...nel.org>, Anna-Maria Behnsen <anna-maria@...utronix.de>,
Frederic Weisbecker <frederic@...nel.org>, Tejun Heo <tj@...nel.org>,
Johannes Weiner <hannes@...xchg.org>, "Michal Koutný" <mkoutny@...e.com>,
"Rafael J. Wysocki" <rafael@...nel.org>, Pavel Machek <pavel@...nel.org>,
Roman Gushchin <roman.gushchin@...ux.dev>, Chen Ridong <chenridong@...wei.com>,
kernel-team@...roid.com, Jonathan Corbet <corbet@....net>, Shuah Khan <shuah@...nel.org>,
cgroups@...r.kernel.org, linux-doc@...r.kernel.org,
linux-kselftest@...r.kernel.org
Subject: [PATCH v4 0/2] cgroup: Track time in cgroup v2 freezer
Hello,
The cgroup v2 freezer controller is useful for freezing background
applications so they don't contend with foreground tasks. However, this
may disrupt any internal monitoring that the application is performing,
as it may not be aware that it was frozen.
To illustrate, an application might implement a watchdog thread to
monitor a high-priority task by periodically checking its state to
ensure progress. The challenge is that the task only advances when the
application is running, but watchdog timers are set relative to system
time, not app time. If the app is frozen and misses the expected
deadline, the watchdog, unaware of this pause, may kill a healthy
process.
This series tracks the time that each cgroup spends "freezing" and
exposes it via cgroup.stat.local. Include several basic selftests to
demonstrate the expected behavior of this interface, including that:
1. Freeze time will increase while a cgroup is freezing, regardless of
whether it is frozen or not.
2. Each cgroup's freeze time is independent from the other cgroups in
its hierarchy.
Thanks,
Tiffany
Signed-off-by: Tiffany Yang <ynaffit@...gle.com>
---
v3: https://lore.kernel.org/all/20250805032940.3587891-4-ynaffit@google.com/
v2: https://lore.kernel.org/lkml/20250714050008.2167786-2-ynaffit@google.com/
v1: https://lore.kernel.org/lkml/20250603224304.3198729-3-ynaffit@google.com/
Cc: John Stultz <jstultz@...gle.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Stephen Boyd <sboyd@...nel.org>
Cc: Anna-Maria Behnsen <anna-maria@...utronix.de>
Cc: Frederic Weisbecker <frederic@...nel.org>
Cc: Tejun Heo <tj@...nel.org>
Cc: Johannes Weiner <hannes@...xchg.org>
Cc: Michal Koutný <mkoutny@...e.com>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: Pavel Machek <pavel@...nel.org>
Cc: Roman Gushchin <roman.gushchin@...ux.dev>
Cc: Chen Ridong <chenridong@...wei.com>
Signed-off-by: Tiffany Yang <ynaffit@...gle.com>
Tiffany Yang (2):
cgroup: cgroup.stat.local time accounting
cgroup: selftests: Add tests for freezer time
Documentation/admin-guide/cgroup-v2.rst | 18 +
include/linux/cgroup-defs.h | 17 +
kernel/cgroup/cgroup.c | 28 +
kernel/cgroup/freezer.c | 16 +-
tools/testing/selftests/cgroup/test_freezer.c | 663 ++++++++++++++++++
5 files changed, 738 insertions(+), 4 deletions(-)
--
2.51.0.rc2.233.g662b1ed5c5-goog
Powered by blists - more mailing lists