From: Tiffany Yang <ynaffit@google.com>
To: "Michal Koutný" <mkoutny@suse.com>
Cc: linux-kernel@vger.kernel.org, John Stultz <jstultz@google.com>,
Thomas Gleixner <tglx@linutronix.de>,
Stephen Boyd <sboyd@kernel.org>,
Anna-Maria Behnsen <anna-maria@linutronix.de>,
Frederic Weisbecker <frederic@kernel.org>,
Tejun Heo <tj@kernel.org>, Johannes Weiner <hannes@cmpxchg.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Pavel Machek <pavel@kernel.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Chen Ridong <chenridong@huawei.com>,
kernel-team@android.com, Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <shuah@kernel.org>,
cgroups@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kselftest@vger.kernel.org
Subject: Re: [RFC PATCH v3 2/2] cgroup: selftests: Add tests for freezer time
Date: Tue, 19 Aug 2025 16:05:09 -0700 [thread overview]
Message-ID: <dbx81pp6syje.fsf@ynaffit-andsys.c.googlers.com> (raw)
In-Reply-To: <ftydqeu3zxmgdvkz6f4jrf4qyrs72ar7jc4j3khlkyi4mditfe@g62znohovca7> ("Michal =?utf-8?Q?Koutn=C3=BD=22's?= message of "Thu, 14 Aug 2025 18:18:47 +0200")
Michal Koutný <mkoutny@suse.com> writes:
...
> if (curr < 0) {
> ret = KSFT_SKIP;
> goto cleanup;
> }
> if (curr > 0) {
> debug("Expect time (%ld) to be 0\n", curr);
> goto cleanup;
> }
> I might like the version with less indentation and explicit guards. It's
> only minor stylistic issue.
Noted! Will be fixed in v4.
>> +
>> + /*
>> + * 2) Freeze the cgroup. Check that its freeze time is
>> + * larger than 0.
>> + */
>> + if (cg_freeze_nowait(cgroup, true))
>> + goto cleanup;
>> + prev = curr;
>> + curr = cg_check_freezetime(cgroup);
>> + if (curr <= prev) {
> Here and...
>> + debug("Expect time (%ld) > 0\n", curr);
>> + goto cleanup;
>> + }
>> +
>> + /*
>> + * 3) Sleep for 100 us. Check that the freeze time is at
>> + * least 100 us larger than it was at 2).
>> + */
>> + usleep(100);
>> + prev = curr;
>> + curr = cg_check_freezetime(cgroup);
>> + if ((curr - prev) < 100) {
> ...here
> I'm slightly worried it may cause test flakiness on systems with too
> coarse clock granularity.
> Is the first check anyhow meaningful? (I think it's only as strong as
> checking return value of the preceding write(2) to cgroup.freeze.)
Hmm I had originally put the check at 2) in to make sure that the value
increases as expected for an empty cgroup (the simplest case), but I
think the check at 3) (and most other checks in these test cases)
establish the same thing.
The other purpose it serves is to act as kind of a buffer for the time
it takes to freeze the cgroup (t_1 -> t_2) to ensure that the cgroup
would be frozen for the entirety of the sleep. I.e., preventing the case
where we fail the check because the time measured at t_3 ends up being
(100 - the time it took to freeze).
That said, the time between writing to an empty cgroup's cgroup.freeze
and it beginning to freeze is basically negligible relative to the time
scales in this test, so I'm happy to take it out!
(If what I've written above is worded too confusingly, ignore it.
TL;DR: we don't need this check! I'm taking it out!)
> Would it compromise your use case if the latter check was at least
> 1000 μs (based on other usleeps in cgroup selftests)? (Ditto for other
> 100 μs checks.)
Not at all! I'll make this change for v4.
Thanks,
--
Tiffany Y. Yang
prev parent reply other threads:[~2025-08-19 23:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-05 3:29 [RFC PATCH v3 0/2] cgroup: Track time in cgroup v2 freezer Tiffany Yang
2025-08-05 3:29 ` [RFC PATCH v3 1/2] cgroup: cgroup.freeze.stat.local time accounting Tiffany Yang
2025-08-11 18:51 ` Tejun Heo
2025-08-14 1:30 ` Tiffany Yang
2025-08-14 15:54 ` Michal Koutný
2025-08-05 3:29 ` [RFC PATCH v3 2/2] cgroup: selftests: Add tests for freezer time Tiffany Yang
2025-08-14 16:18 ` Michal Koutný
2025-08-19 23:05 ` Tiffany Yang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dbx81pp6syje.fsf@ynaffit-andsys.c.googlers.com \
--to=ynaffit@google.com \
--cc=anna-maria@linutronix.de \
--cc=cgroups@vger.kernel.org \
--cc=chenridong@huawei.com \
--cc=corbet@lwn.net \
--cc=frederic@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=jstultz@google.com \
--cc=kernel-team@android.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mkoutny@suse.com \
--cc=pavel@kernel.org \
--cc=rafael@kernel.org \
--cc=roman.gushchin@linux.dev \
--cc=sboyd@kernel.org \
--cc=shuah@kernel.org \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®