From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0573CC83F0A for ; Wed, 9 Jul 2025 18:22:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 66A4A6B012B; Wed, 9 Jul 2025 14:22:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 61AE56B012D; Wed, 9 Jul 2025 14:22:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 530866B012E; Wed, 9 Jul 2025 14:22:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 3F1996B012B for ; Wed, 9 Jul 2025 14:22:24 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B021D1602D0 for ; Wed, 9 Jul 2025 18:22:23 +0000 (UTC) X-FDA: 83645546166.12.1AEB444 Received: from maynard.decadent.org.uk (maynard.decadent.org.uk [65.21.191.19]) by imf09.hostedemail.com (Postfix) with ESMTP id 0605C14000B for ; Wed, 9 Jul 2025 18:22:21 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; spf=pass (imf09.hostedemail.com: domain of ben@decadent.org.uk designates 65.21.191.19 as permitted sender) smtp.mailfrom=ben@decadent.org.uk ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1752085342; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QTrFTMPcQk8/SMXFk7leAOsw6te6Px6P1Chn49P59Qc=; b=xGn50zITzHBG3wiurI4CUDLmamMn9D2/DANECXFHus/4k3BGgRRTtzdVB++xGt2pcO4MJD sqTuDh+l1LIbKXPiC3u4CIpMqz4KDIKLN02arBmy5TvL9FiTfXw4Y8nQnzBYPKbd9YVzSm aCnGQIS914sX4n8JmWZmnbBdVF+bL8A= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf09.hostedemail.com: domain of ben@decadent.org.uk designates 65.21.191.19 as permitted sender) smtp.mailfrom=ben@decadent.org.uk ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1752085342; a=rsa-sha256; cv=none; b=rGcLgg6ED7xqydVUd3XQoj/x41rWMuTGE5/iuIS0EiyECwXRJFkzXrGRGaGbDFGd/h6Pe5 5F0zEnXjOHULFKooJibHmEk/7fbEAhYadQjR2olhrIvRsQXZaG66MMYmy11ThLYPc5M7bb q3UW3dYAZez1ZL3S4H6cIaRE13ZBcp4= Received: from [89.234.162.240] (helo=deadeye) by maynard with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uZZQv-004kJU-1J; Wed, 09 Jul 2025 18:22:16 +0000 Received: from ben by deadeye with local (Exim 4.98.2) (envelope-from ) id 1uZZQt-0000000Ansu-2wDp; Wed, 09 Jul 2025 20:22:15 +0200 Message-ID: Subject: Re: [PATCH 4/4] cgroup: Do not report unavailable v1 controllers in /proc/cgroups From: Ben Hutchings To: Michal =?ISO-8859-1?Q?Koutn=FD?= , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Tejun Heo , Zefan Li , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , Chen Ridong , 1108294@bugs.debian.org Date: Wed, 09 Jul 2025 20:22:09 +0200 In-Reply-To: <20240909163223.3693529-5-mkoutny@suse.com> References: <20240909163223.3693529-1-mkoutny@suse.com> <20240909163223.3693529-5-mkoutny@suse.com> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-Mdj+QvgzK/UNDkneOc1n" User-Agent: Evolution 3.56.1-1 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 89.234.162.240 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on maynard); SAEximRunCond expanded to false X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 0605C14000B X-Stat-Signature: kfej8fq3skxjkucnpa88f1aj5h4f6fq1 X-Rspam-User: X-HE-Tag: 1752085341-503059 X-HE-Meta: U2FsdGVkX1+tWO4qYvCKZ75Qee40PlzJtLJY9OLB4MWjaFmka5Zfg33tzq2UWvbo6YOossvfzxa8hMP+RbMjUcQwWYAqLBU9YoBziA+RSAj3FyVH/19a4dowZo9DpLZ+f/QZmJn0spjbl+4joIFBrANg25nIdWdb+++JDrM4+3/KZdKAkDDQeGz7cNsN0kU6qdNOjk2irtfAe+hHRJg5gJFqytI1JsRYxajrXHUHXZQwMVqnylIvp0++Ig9oB7KtbvUsDg0nsChmLPXijoyzJ3R9NFMzVGPWYeFFugaIhqQ02/OoXydxhBkYN2kVrfG3FoNVFrT0x+/qIMebVZm0GH/CGAd609vL70n+Ebb/GP4wPJ2LS7o6jhYe0NAhg3cKkCoGZ9jBlFeD7NS0lzcB50dkQCpYyB6prG74svQYaYw1JJOz/ilID5LbzLFRQxL1e5x23D2vsPkfD+xJ3qkpIrb9tQnJkC1fopU2kFvBtYjeGdBZMfNtRbBxVlxSUwFSLdg1d1fU3GwQLXW508vWcHzNUPeqkZ4jA7ICEdIAI43kS0q2Rju6c9A5M3JvaJysUVXM+lWGCCPXOjj+NKvniCQU9u9/oBlVbBQKluGUHU1l1Roh/iHywdLdGEXcljXpyDTE8R1uOqyhg191HjVJfJpwlYUVZ1B+n+WHYOFMz4TzQ9PlpLkr4iI9zDetDJqS/XpZ79GMMZDzijG/CkzjEI+wJBzHdjoxBF2dAfASLq/q+JLsKeFJK3ceJo+qrf2P X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: --=-Mdj+QvgzK/UNDkneOc1n Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 2024-09-09 at 18:32 +0200, Michal Koutn=C3=BD wrote: > This is a followup to CONFIG-urability of cpuset and memory controllers > for v1 hierarchies. Make the output in /proc/cgroups reflect that > !CONFIG_CPUSETS_V1 is like !CONFIG_CPUSETS and > !CONFIG_MEMCG_V1 is like !CONFIG_MEMCG. >=20 > The intended effect is that hiding the unavailable controllers will hint > users not to try mounting them on v1. This change can cause problems for the OpenJDK JVM, as reported in . Since OpenJDK version 11, the JVM can detect and adapt to cpuset and memory limits. It supports both the cgroups v1 and v2 API, but before version 25 it always relied on /proc/cgroups to detect whether those controllers were enabled. The result of this patch is that if CONFIG_MEMCG_V1 is disabled the JVM can easily trigger OOM when otherwise it would trim its memory usage through garbage collection. (For cpusets, I'm not sure of the impact but I think it might make bad decisions about the size of thread pools.) Although the fix in OpenJDK 25 can probably be backported to older versions, this issue primarily affects container workloads so fixing this in distribution packages would not be sufficient. The obvious compatibility fix for this at the kernel level is to enable CONFIG_{CPUSETS,MEMCG}_V1. But since the v1 API has long been deprecated and is not actually needed by OpenJDK, I would prefer not to do that. Would you consider reverting this change for the sake of compatibility? Ben. > Signed-off-by: Michal Koutn=C3=BD > --- > kernel/cgroup/cgroup-v1.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) >=20 > diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c > index 784337694a4be..e28d5f0d20ed0 100644 > --- a/kernel/cgroup/cgroup-v1.c > +++ b/kernel/cgroup/cgroup-v1.c > @@ -681,11 +681,14 @@ int proc_cgroupstats_show(struct seq_file *m, void = *v) > * cgroup_mutex contention. > */ > =20 > - for_each_subsys(ss, i) > + for_each_subsys(ss, i) { > + if (cgroup1_subsys_absent(ss)) > + continue; > seq_printf(m, "%s\t%d\t%d\t%d\n", > ss->legacy_name, ss->root->hierarchy_id, > atomic_read(&ss->root->nr_cgrps), > cgroup_ssid_enabled(i)); > + } > =20 > return 0; > } --=20 Ben Hutchings 73.46% of all statistics are made up. --=-Mdj+QvgzK/UNDkneOc1n Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEErCspvTSmr92z9o8157/I7JWGEQkFAmhus1EACgkQ57/I7JWG EQlMxg//Zu5qojY6j83XeXXdP+Nfmb6fFI9BIxkDydDpUDo+nVbaocvUlKBmssLq gT92YpjnemhmsHM9iTlGrMJ7A+PfqmYCUzRGYWHI/grx6GiO/PMxC4Qs5PfMAdRC SZsldb1qzQWB+8fh0NBwmAOX0UiYyx38yZe3jzz47pCoLAlold4U84x02ayPsvw5 vHCwbCoCwtBFl1mStS0alqPozuLeiJFocONjE4jgyDKCnNv0S5NLwbfdFFbA60nh WolGPvsTtkUP1HRjXoGnpnNVseb5ZQ9H2d1Z2itvH6/mumnLFttdecJm3QiPg6LG Npis/j2LIqiR82DpQqg7Yi4H658Roo0j2cN//Gjij/6wET2Mwk4S1AV6Qk3IevJ9 lzqRO7xvTe+VjUvtfhLQYvAlYaIL2oJBL9d6ofTBtIhA+3xdeaRrMRHi5ah55pre Rq4px/nQAaU9fao8B9HvA/TDYAtCLOmwe12jvjthhuK0crqH4RvhGUD6/sCT2u51 2DNeCeJUyUeGZWEYXhyloeI8x4alJxeGCW0bGhxLj8Im8T95RUNWG+V82QEz9Q5L l3IHyTEFC/yQeP7yMflCInl4oe8kUFZT4J9fN5Z/wPXN2JYe7QiT/HvtmtQoQQT9 FBNrT4PbC4PW8Cf6WLMnNk620qsg8ErGzsQx00tjMYwVK0VJLug= =Ws1Z -----END PGP SIGNATURE----- --=-Mdj+QvgzK/UNDkneOc1n--