<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/tools/testing/selftests/cgroup, branch v6.18.34</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.18.34</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.18.34'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-05-23T11:06:41+00:00</updated>
<entry>
<title>selftest: memcg: skip memcg_sock test if address family not supported</title>
<updated>2026-05-23T11:06:41+00:00</updated>
<author>
<name>Waiman Long</name>
<email>longman@redhat.com</email>
</author>
<published>2026-03-11T20:05:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2fdb6c1e743d2d442b19a1bc702a38d5a0c3c7f2'/>
<id>urn:sha1:2fdb6c1e743d2d442b19a1bc702a38d5a0c3c7f2</id>
<content type='text'>
[ Upstream commit 2d028f3e4bbbfd448928a8d3d2814b0b04c214f4 ]

The test_memcg_sock test in memcontrol.c sets up an IPv6 socket and send
data over it to consume memory and verify that memory.stat.sock and
memory.current values are close.

On systems where IPv6 isn't enabled or not configured to support
SOCK_STREAM, the test_memcg_sock test always fails.  When the socket()
call fails, there is no way we can test the memory consumption and verify
the above claim.  I believe it is better to just skip the test in this
case instead of reporting a test failure hinting that there may be
something wrong with the memcg code.

Link: https://lkml.kernel.org/r/20260311200526.885899-1-longman@redhat.com
Fixes: 5f8f019380b8 ("selftests: cgroup/memcontrol: add basic test for socket accounting")
Signed-off-by: Waiman Long &lt;longman@redhat.com&gt;
Acked-by: Michal Koutný &lt;mkoutny@suse.com&gt;
Acked-by: Shakeel Butt &lt;shakeel.butt@linux.dev&gt;
Cc: Johannes Weiner &lt;hannes@cmpxchg.org&gt;
Cc: Michal Hocko &lt;mhocko@kernel.org&gt;
Cc: Michal Koutný &lt;mkoutny@suse.com&gt;
Cc: Mike Rapoport &lt;rppt@kernel.org&gt;
Cc: Muchun Song &lt;muchun.song@linux.dev&gt;
Cc: Roman Gushchin &lt;roman.gushchin@linux.dev&gt;
Cc: Shuah Khan &lt;shuah@kernel.org&gt;
Cc: Tejun Heo &lt;tj@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: cgroup: Use values_close_report in test_cpu</title>
<updated>2025-10-15T15:00:59+00:00</updated>
<author>
<name>Sebastian Chlad</name>
<email>sebastianchlad@gmail.com</email>
</author>
<published>2025-10-15T10:33:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4cdde87d723a0552f475c8c6b0db472a6945125f'/>
<id>urn:sha1:4cdde87d723a0552f475c8c6b0db472a6945125f</id>
<content type='text'>
Convert test_cpu to use the newly added values_close_report() helper
to print detailed diagnostics when a tolerance check fails. This
provides clearer insight into deviations while run in the CI.

Signed-off-by: Sebastian Chlad &lt;sebastian.chlad@suse.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: cgroup: add values_close_report helper</title>
<updated>2025-10-15T15:00:49+00:00</updated>
<author>
<name>Sebastian Chlad</name>
<email>sebastianchlad@gmail.com</email>
</author>
<published>2025-10-15T10:33:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3f9c60f4d3cc3e7f4dd7cac05011ea06d512050f'/>
<id>urn:sha1:3f9c60f4d3cc3e7f4dd7cac05011ea06d512050f</id>
<content type='text'>
Some cgroup selftests, such as test_cpu, occasionally fail by a very
small margin and if run in the CI context, it is useful to have detailed
diagnostic output to understand the deviation.

Introduce a values_close_report() helper which performs the same
comparison as values_close(), but prints detailed information when the
values differ beyond the allowed tolerance.

Signed-off-by: Sebastian Chlad &lt;sebastian.chlad@suse.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: cgroup: Make test_pids backwards compatible</title>
<updated>2025-08-27T15:59:52+00:00</updated>
<author>
<name>Michal Koutný</name>
<email>mkoutny@suse.com</email>
</author>
<published>2025-08-27T15:53:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3b0dec689a6301845761681b852f9538cb75a1d2'/>
<id>urn:sha1:3b0dec689a6301845761681b852f9538cb75a1d2</id>
<content type='text'>
The predicates in test expect event counting from 73e75e6fc352b
("cgroup/pids: Separate semantics of pids.events related to pids.max")
and the test would fail on older kernels. We want to have one version of
tests for all, so detect the feature and skip the test on old kernels.
(The test could even switch to check v1 semantics based on the flag but
keep it simple for now.)

Fixes: 9f34c566027b6 ("selftests: cgroup: Add basic tests for pids controller")
Signed-off-by: Michal Koutný &lt;mkoutny@suse.com&gt;
Tested-by: Sebastian Chlad &lt;sebastian.chlad@suse.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>cgroup: selftests: Add tests for freezer time</title>
<updated>2025-08-22T17:50:52+00:00</updated>
<author>
<name>Tiffany Yang</name>
<email>ynaffit@google.com</email>
</author>
<published>2025-08-22T01:37:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7b281a4582c4408add22cc99f221886b50dd0548'/>
<id>urn:sha1:7b281a4582c4408add22cc99f221886b50dd0548</id>
<content type='text'>
Test cgroup v2 freezer time stat. Freezer time accounting should
be independent of other cgroups in the hierarchy and should increase
iff a cgroup is CGRP_FREEZE (regardless of whether it reaches
CGRP_FROZEN).

Skip these tests on systems without freeze time accounting.

Signed-off-by: Tiffany Yang &lt;ynaffit@google.com&gt;
Cc: Michal Koutný &lt;mkoutny@suse.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests/cgroup: fix cpu.max tests</title>
<updated>2025-07-17T18:12:19+00:00</updated>
<author>
<name>Shashank Balaji</name>
<email>shashank.mahadasyam@sony.com</email>
</author>
<published>2025-07-04T11:08:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=954bacce36d976fe472090b55987df66da00c49b'/>
<id>urn:sha1:954bacce36d976fe472090b55987df66da00c49b</id>
<content type='text'>
Current cpu.max tests (both the normal one and the nested one) are broken.

They setup cpu.max with 1000 us quota and the default period (100,000 us).
A cpu hog is run for a duration of 1s as per wall clock time. This corresponds
to 10 periods, hence an expected usage of 10,000 us. We want the measured
usage (as per cpu.stat) to be close to 10,000 us.

Previously, this approximate equality test was done by
`!values_close(usage_usec, expected_usage_usec, 95)`: if the absolute
difference between usage_usec and expected_usage_usec is greater than 95% of
their sum, then we pass. And expected_usage_usec was set to 1,000,000 us.
Mathematically, this translates to the following being true for pass:

	|usage - expected_usage| &gt; (usage + expected_usage)*0.95

	If usage &gt; expected_usage:
		usage - expected_usage &gt; (usage + expected_usage)*0.95
		0.05*usage &gt; 1.95*expected_usage
		usage &gt; 39*expected_usage = 39s

	If usage &lt; expected_usage:
		expected_usage - usage &gt; (usage + expected_usage)*0.95
		0.05*expected_usage &gt; 1.95*usage
		usage &lt; 0.0256*expected_usage = 25,600 us

Combined,

	Pass if usage &lt; 25,600 us or &gt; 39 s,

which makes no sense given that all we need is for usage_usec to be close to
10,000 us.

Fix this by explicitly calcuating the expected usage duration based on the
configured quota, default period, and the duration, and compare usage_usec
and expected_usage_usec using values_close() with a 10% error margin.

Also, use snprintf to get the quota string to write to cpu.max instead of
hardcoding the quota, ensuring a single source of truth.

Remove the check comparing user_usec and expected_usage_usec, since on running
this test modified with printfs, it's seen that user_usec and usage_usec can
regularly exceed the theoretical expected_usage_usec:

	$ sudo ./test_cpu
	user: 10485, usage: 10485, expected: 10000
	ok 1 test_cpucg_max
	user: 11127, usage: 11127, expected: 10000
	ok 2 test_cpucg_max_nested
	$ sudo ./test_cpu
	user: 10286, usage: 10286, expected: 10000
	ok 1 test_cpucg_max
	user: 10404, usage: 11271, expected: 10000
	ok 2 test_cpucg_max_nested

Hence, a values_close() check of usage_usec and expected_usage_usec is
sufficient.

Fixes: a79906570f9646ae17 ("cgroup: Add test_cpucg_max_nested() testcase")
Fixes: 889ab8113ef1386c57 ("cgroup: Add test_cpucg_max() testcase")
Acked-by: Michal Koutný &lt;mkoutny@suse.com&gt;
Signed-off-by: Shashank Balaji &lt;shashank.mahadasyam@sony.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: cgroup: Fix missing newline in test_zswap_writeback_one</title>
<updated>2025-07-12T17:35:30+00:00</updated>
<author>
<name>Sebastian Chlad</name>
<email>sebastianchlad@gmail.com</email>
</author>
<published>2025-07-02T16:40:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e07caae73557d144a9237fb977dfee08befa015f'/>
<id>urn:sha1:e07caae73557d144a9237fb977dfee08befa015f</id>
<content type='text'>
Fixes malformed test output due to missing newline

Signed-off-by: Sebastian Chlad &lt;sebastian.chlad@suse.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: cgroup: Allow longer timeout for kmem_dead_cgroups cleanup</title>
<updated>2025-07-12T17:34:49+00:00</updated>
<author>
<name>Sebastian Chlad</name>
<email>sebastianchlad@gmail.com</email>
</author>
<published>2025-07-02T13:23:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c7d7713e36a6ab4c42e40c952d5ba7a51b1091b0'/>
<id>urn:sha1:c7d7713e36a6ab4c42e40c952d5ba7a51b1091b0</id>
<content type='text'>
The test_kmem_dead_cgroups test currently assumes that RCU and
memory reclaim will complete within 5 seconds. In some environments
this timeout may be insufficient, leading to spurious test failures.

This patch introduces max_time set to 20 which is then used in the
test. After 5th sec the debug message is printed to indicate the
cleanup is still ongoing.

In the system under test with 16 CPUs the original test was failing
most of the time and the cleanup time took usually approx. 6sec.
Further tests were conducted with and without do_rcu_barrier and the
results (respectively) are as follow:
quantiles 0  0.25  0.5  0.75  1
          1    2    3    8    20 (mean = 4.7667)
          3    5    8    8    20 (mean = 7.6667)

Acked-by: Michal Koutny &lt;mkoutny@suse.com&gt;
Signed-off-by: Sebastian Chlad &lt;sebastian.chlad@suse.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: cgroup: Fix compilation on pre-cgroupns kernels</title>
<updated>2025-06-17T18:13:25+00:00</updated>
<author>
<name>Michal Koutný</name>
<email>mkoutny@suse.com</email>
</author>
<published>2025-06-17T13:36:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5da4f9db980cc475bb6f027153cce75eaa3026ec'/>
<id>urn:sha1:5da4f9db980cc475bb6f027153cce75eaa3026ec</id>
<content type='text'>
The test would be skipped because of nsdelegate, so the defined value is
not used (0 is always acceptable).

Signed-off-by: Michal Koutný &lt;mkoutny@suse.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests: cgroup: Optionally set up v1 environment</title>
<updated>2025-06-17T18:13:16+00:00</updated>
<author>
<name>Michal Koutný</name>
<email>mkoutny@suse.com</email>
</author>
<published>2025-06-17T13:36:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d74cd7864ffa6913f1d70f80858bd3fd19101cdf'/>
<id>urn:sha1:d74cd7864ffa6913f1d70f80858bd3fd19101cdf</id>
<content type='text'>
Use the missing mount of the unifier hierarchy as a hint of legacy
system and prepare our own named v1 hierarchy for tests.

The code is only in test_core.c and not cgroup_util.c because other
selftests are related to controllers which will be exposed on v2
hierarchy but named hierarchies are only v1 thing.

Signed-off-by: Michal Koutný &lt;mkoutny@suse.com&gt;
Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
</content>
</entry>
</feed>
