From patchwork Mon Sep 9 16:32:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Michal_Koutn=C3=BD?= X-Patchwork-Id: 13797307 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 E2C05ECE577 for ; Mon, 9 Sep 2024 16:32:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 201406B0191; Mon, 9 Sep 2024 12:32:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0EEE96B0193; Mon, 9 Sep 2024 12:32:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA5E76B0194; Mon, 9 Sep 2024 12:32:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id CA1B06B0191 for ; Mon, 9 Sep 2024 12:32:31 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 795E340C6B for ; Mon, 9 Sep 2024 16:32:31 +0000 (UTC) X-FDA: 82545742902.03.68D2C70 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by imf04.hostedemail.com (Postfix) with ESMTP id 788EF40018 for ; Mon, 9 Sep 2024 16:32:29 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b=ZFWetnud; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf04.hostedemail.com: domain of mkoutny@suse.com designates 209.85.128.45 as permitted sender) smtp.mailfrom=mkoutny@suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725899522; a=rsa-sha256; cv=none; b=YX48Qi7ve/m9Jj6jSfNjOJ3k+dMZt51pjicX9TMFkUvY6trQ/oCHCkwbPOKN35MkwgiCgF /W+s1hoQnIXeisFnn8fKedHWaqUZfkIPR4Q2gdkv4sQ26L++JCYQzlwTWC4gXpNqx8O2QE Alu4pFrEGDYtmu3spKKe5VPKpJ5rtVA= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=suse.com header.s=google header.b=ZFWetnud; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf04.hostedemail.com: domain of mkoutny@suse.com designates 209.85.128.45 as permitted sender) smtp.mailfrom=mkoutny@suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725899522; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=DHl5njwEzB57TRyVYxUn9e/V7vkUkmiZqA1k5LmJoXo=; b=0ilQIC1kZO6v0WK3YAWtyQOJ5HIoShlEF42gqclSHiV4A5wg6hY6pqvpmwhEQSKQcZ28H7 omHttZhaSWTp5+T8iYqoaYWQN0yvf7uLCOQJpZRTzpKEdDDj31r3GNwEn0WN3vcNJJAOcV tEN41rc1vllh1mTkYFozaA8/d/4sBKs= Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-42cb2191107so12985565e9.1 for ; Mon, 09 Sep 2024 09:32:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1725899548; x=1726504348; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DHl5njwEzB57TRyVYxUn9e/V7vkUkmiZqA1k5LmJoXo=; b=ZFWetnudEV57IvHzG6AiTbdxtPsNdFjdsOShVZJb1BqxYGj925HQ1P74DwHJN49yGm dlTAiD9hgAYoLASveQ3y7dRaXmbHEzeXaJXysKyFGF+snXGJiB98asiyep5rcopuvEae P68EB/BO2UPh0aZNAFvHShB1Cc03ZJeee8nYJ8OizH3SHlbiaCKVpAZ55CrRqSVK3x7H z1PCByTfl6Tp7TaUBtuQkfBLXZZfyOX9yaNGL8fSECPs1WK9a/xBOFuC21GrvLLZHeEH lGcV1sOwa/1IqN/+PCe3+eApWI0bjuV3mwkYHXwAxHp1AN14leq58MpTcPo5OeJNVMGN jdVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725899548; x=1726504348; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DHl5njwEzB57TRyVYxUn9e/V7vkUkmiZqA1k5LmJoXo=; b=C2hBZVrrpeAxHHoNOwGwHZmNT9RalC+Bx7DjoLQTgzIP/5k36PiJGC0xXFTTVe28PX qjt2pVte31G6gA8kmk3kr/MBHZW4qy9wnXWlGS1SCFvhCqNwC85S8SH8Ftk9p2/1TAL4 MJNrVLNDTw7mOOx8MC2wNnLwxdVep5av/Gb3QXENOtHvaC9daz1LfI06skHpIy94dJeD joseQoV4Kq27ZxLv8z2T4uc9ny8ihUiNtpAJ0aa5IX8PvpjGsypeDwSa6IbgJQku77cF qC292o+CjCzW9a7eMZh3NYcJSjs+/DWNX93C1IctJHmUk/8msYkl7gwSBvFOq3LP+QcL lRQw== X-Forwarded-Encrypted: i=1; AJvYcCVRVxNfgzZf8BPTcmXY57T0KGFtIgb+m9zWzOkVPatNGf7alg+t03UluWBH0Utl3iL/gztjyI412g==@kvack.org X-Gm-Message-State: AOJu0Yy1R/gnIudU3TAQGN/BqKoclPeCiuKZvevojZuWpIXfwdxKhFAx kCTq22S+XdtGyrqdzxV9A43WqTdbyH5i3xl0eH0HR/sg/U65qskStLxFh10+5BFvrAMm+svcaz4 n X-Google-Smtp-Source: AGHT+IH/NtJ7GDbpp/KCJNR64qpb8/rUL9ftAz+gBxAS7bLeKc9E0iYJrQXSaE8AaWMsJe84oBWC9A== X-Received: by 2002:a05:600c:314c:b0:42b:a88f:f872 with SMTP id 5b1f17b1804b1-42cadb699b9mr62524805e9.32.1725899547875; Mon, 09 Sep 2024 09:32:27 -0700 (PDT) Received: from blackdock.suse.cz ([193.86.92.181]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3789564a072sm6478606f8f.2.2024.09.09.09.32.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 09:32:27 -0700 (PDT) From: =?utf-8?q?Michal_Koutn=C3=BD?= To: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Tejun Heo , Zefan Li , Johannes Weiner , =?utf-8?q?Michal_Koutn=C3=BD?= , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , Chen Ridong Subject: [PATCH 4/4] cgroup: Do not report unavailable v1 controllers in /proc/cgroups Date: Mon, 9 Sep 2024 18:32:23 +0200 Message-ID: <20240909163223.3693529-5-mkoutny@suse.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240909163223.3693529-1-mkoutny@suse.com> References: <20240909163223.3693529-1-mkoutny@suse.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 788EF40018 X-Rspamd-Server: rspam01 X-Stat-Signature: 5n66xrzi93xyxwrwtgg6zqfws83e5ias X-HE-Tag: 1725899549-796300 X-HE-Meta: U2FsdGVkX1/HTI+neKFI5clPwS0TMsGo1taDXUX+wU5+M0K9sQZDmQ3cuacQwASZQP4PjFsR0gqE9QdG+6/TJzJnjN6BhHid2bB9gB+RSipb2XCdDZFluPealfxtijUyf9sdnhxnGtxVgFASVHmlLc4o1BMFFDEnn2B4HtlkDp3y8m/2PbgUiGP4JSRiTCer5y1qPhirtZI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0y6kNIJ6LLqauz0XhX/JdyurITBWST8vFvXDkqnB+qqLQvGgngx/gVtuOehI0Vsf7pcS+QxvEkqk= 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: 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. The intended effect is that hiding the unavailable controllers will hint users not to try mounting them on v1. Signed-off-by: Michal Koutný Reviewed-by: Waiman Long --- kernel/cgroup/cgroup-v1.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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. */ - 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)); + } return 0; }