From nobody Sat Feb 7 03:52:20 2026 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BB32165F0B for ; Mon, 9 Sep 2024 16:32:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725899549; cv=none; b=fT9FpmyOdabQtlBc2kMqBU9fGBtC7EUKzlEPIsUiU0moD0nG5v9hz10VrsbdQF+rGBOBOYWfmWIhTZWT7uvRr9Cr0hm1+Ge2j4QapUc1GAFGVHbzYnbbQIs+Rn2MFlO4YPpIXSpb4ZvTZLvtDY+YHBo4WTxzFLLvWdsZE1zBOKs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725899549; c=relaxed/simple; bh=5wi8Dcw3wd8SAW+yjS2gtvuUpo3vzMFwvlt6X1nV1HE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ka+7ru1N9TVZqTljiuoRc0bX2K1RPtpI48s+Y+VUuHN8S/6PjZ6uDXyyMAIR63Ka4G7kLYONI3FhzP/+/PEC1j366GFZ5fU6RCa486v4od83oiwb7fuP84tJvKqc+3MvbrWMCReufeqoC/Cq8B+uOCHPi5Sf2kQb/DfJMcdhXLg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=eTejcysy; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="eTejcysy" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-42cacabd2e0so24587195e9.3 for ; Mon, 09 Sep 2024 09:32:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1725899546; x=1726504346; darn=vger.kernel.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=qcEdQE9kkUNRmd1oSgPgT8tBtd/F56AnD10peYUx9eU=; b=eTejcysyVlGYCEHDZ4Lx3IWvY73sExclGQ0Lfu6SGEjAMvz+rDx0nqemrVY7OzGEXm vI/IAw0xT+hvV1wyyzGO8uNF4clDjkVTUrIe+gFfXqBbZE6BAtEvK6RtSOxFhjKyFxN3 MNX/4i/pwigu5QVoroJr0P5HhTi2i8j9R165J7JkuW2zq0d5srrc73PCN8jWC/W4WAYx 0cGTdJQUvVU5bvzrfV8M+BeAx3+N7bJ/JiHjE03VgXoiByOvfTrini/FaIj409EyNctP qYhlQzEjtZ60jgJ1E4Ch8iekHi7asfpokYK3qX1slxYVEwgUFxlOmKDZ6MIKERgsIRo6 6FhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725899546; x=1726504346; 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=qcEdQE9kkUNRmd1oSgPgT8tBtd/F56AnD10peYUx9eU=; b=VX95u+95tilMUyU0Ji9mCFmn/53lyw+a1WBjJdTUzVSfZwmpLeIwuh7gfWlI1djRI5 0G1W8fIGRnWzw0/wcskm0kwoTJF3RBW0PIAiesSccAp5SCPKZd4ru07aalSwMCrEXhj5 AfK/jwc2keJ3JNDW4oJMCibO3/RINZjqAOHNkn95tmEOy3F1XGjA8QS7Z9HA0Bbrj6UA nOcDbj8KuG7d3yx/VJuBwLIY3UHT58Qp17wwHX8ZimTsJZ/pTxaMYNfIZII04dUlrtl+ 6V3Ph9WbDxq9tDg6/gOPl6VTykyknGGTKR8uO/WwVFpl1hfSuV3V1trIBBpaHBsb6MOA R9VQ== X-Forwarded-Encrypted: i=1; AJvYcCUqLLXxtqIG29liHOWcCcscGJUXzj6Q4JSbG0I/sE8EDr/j83Mpvpynx26ZHFJLS5e7nkdSevopMmF1CD8=@vger.kernel.org X-Gm-Message-State: AOJu0YzwENu8nm/X107LyVbuAzcFZPJKAhgraHkCBb+5TJKLH7GjLUWg 96MxmVS6zHeoEzRwG/8ifFgNeKMcjjceh7X9sRh7tNvo8BdG5asK4uziW2KnsKE= X-Google-Smtp-Source: AGHT+IFYKssoeiQ8071s5mgXvgeKUkJPqXfUO0b5wcMLkjdGWzc7MF/UiF8wCm6ppGL882KotfQOTg== X-Received: by 2002:a05:600c:1c81:b0:42c:bbd5:af70 with SMTP id 5b1f17b1804b1-42cbbd5b273mr10759625e9.30.1725899545970; Mon, 09 Sep 2024 09:32:25 -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.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 09:32:25 -0700 (PDT) From: =?UTF-8?q?Michal=20Koutn=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=20Koutn=C3=BD?= , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , Chen Ridong Subject: [PATCH 1/4] memcg: Cleanup with !CONFIG_MEMCG_V1 Date: Mon, 9 Sep 2024 18:32:20 +0200 Message-ID: <20240909163223.3693529-2-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Extern declarations have no definitions with !CONFIG_MEMCG_V1 and no users, drop them altogether. Signed-off-by: Michal Koutn=C3=BD Acked-by: Shakeel Butt Acked-by: Tejun Heo --- mm/memcontrol-v1.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/mm/memcontrol-v1.h b/mm/memcontrol-v1.h index 56d7eaa982741..db2ebf8bea6c5 100644 --- a/mm/memcontrol-v1.h +++ b/mm/memcontrol-v1.h @@ -140,8 +140,6 @@ static inline bool memcg1_charge_skmem(struct mem_cgrou= p *memcg, unsigned int nr gfp_t gfp_mask) { return true; } static inline void memcg1_uncharge_skmem(struct mem_cgroup *memcg, unsigne= d int nr_pages) {} =20 -extern struct cftype memsw_files[]; -extern struct cftype mem_cgroup_legacy_files[]; #endif /* CONFIG_MEMCG_V1 */ =20 #endif /* __MM_MEMCONTROL_V1_H */ --=20 2.46.0 From nobody Sat Feb 7 03:52:20 2026 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F35C1662E4 for ; Mon, 9 Sep 2024 16:32:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725899550; cv=none; b=LdS41xV/YfKcnVl0Sok7xQZL4Q1pjnyqiWJyFXp9t84xytZiwIrqdXn76Zrfn6Y54qCICdgWTU49uzXrLQmQQgkRLuytJCm+fTdOLUdA8CeXfYJPP503TQBn/kPIDIfu6T0dSsCzqFrvo0aBr2lJxtoJ27vm97uVLed3qoiHk/U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725899550; c=relaxed/simple; bh=iMVZjh7xj4+ygIIIc/WPUfeZ+OxGtc9LdVyEVn81WZI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AgSdykXR02jw5TmSNU5k2CYSFAnYgSIupZ4MP4IfHYCrb99lwGu4pInksZqHdFjsyjNYfY3TfX/Cb796ppf55yNxToNxkALa8TmAGwet9GawFV/Kcgs+A8SPqhpHOVi7+Jdbg1hif/FZqFvigivg2DDVxPYTCxLbrAQxYTlicLI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=PCNglOSx; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="PCNglOSx" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-42cbbb1727eso4670455e9.2 for ; Mon, 09 Sep 2024 09:32:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1725899547; x=1726504347; darn=vger.kernel.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=sobUieX7sbiSPYFy6bxdFPzYBPZvmuQtQFMPmLF111k=; b=PCNglOSxBMYm7fD4+fTmcT0zPpzLAshxwcQDUqDnWF0LIfIEVHYm2xPIar+NQBHqhH ywoQAlXl1SLI0b6iJzq50Jr0tLI3fD1tWdiTG4WGlFDiSsW2cgMEzdo6cRPv9hhe3MVY yqVvuDGBEoT2sD0UTsSLghVvcjIz9Y0QQIjFNBs5kKfaI4dQd4+0MdpQcjHjXX7GGv/t yswJ7wkg8WJk4vu5/OT/ExQcxXET5OiHtsslhSsbwZufyvXjkPRYfTTYYlzj1ukMdGnB 3YZz1vzl3RLVqu6IOO84nQubSp4aINiKHG8HrK8+Qpml5Q76oxgkqKDBnYEVtsPB5JWa xA1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725899547; x=1726504347; 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=sobUieX7sbiSPYFy6bxdFPzYBPZvmuQtQFMPmLF111k=; b=nJ5w6LpxCK7GpxKRxyPUZNd0cVAh/jJuONUh5bRPSJkI8VLCl4UVH0KQ1I6bjVGm1h /BEjfMc+XWu8nMt3RpjZpipWM+7vBD9DtvkyiqellzYCvh8zC2WZf4Cdhoa8pq7eObQF BytvEw0epkDuyP/2/3bHKfPRJIVVjirOwiInoY5tbklTm6RzD0F2Rwzi2HOPh9LYUfHL wWEKA8vPGAvHljY+11srusYlFlX9/Yk7xn1h46sV+Iw+KUKu06mjfNAQa6c2SjiBSyUR QaKYHQVFDnMTflAB+PByggI7+NsFwlAyeF0n9FtptqyWjPksE5UGOucV5OBia8ed1sgb UApw== X-Forwarded-Encrypted: i=1; AJvYcCVkM756DUsD/8VM3SJ/45WbxFyth2IZ+5Fh4QyQ0dGdo5UU89SnqZxVRgG26tW8NTeV7Q1GMrk/R4aB5mk=@vger.kernel.org X-Gm-Message-State: AOJu0YxoAKxOkZ4h7fzZ0cOQA5rvAA9upipdDh7eY4tRcVU2SIgHKLdX wz7OLHf8gjr1uPtNVOL6yEAlgxS12L28vSdYUv10p5MN4ySgSUKv5c+GoNkiS0g= X-Google-Smtp-Source: AGHT+IHP56w+Vwo326v4est5mKtZvXJI1kCa6K6pwhkIOZ6Q1r5Njpbo29H7KJ8jdrsk9xU+NzXgbg== X-Received: by 2002:a05:600c:1ca0:b0:42c:b995:20d3 with SMTP id 5b1f17b1804b1-42cb9952478mr18658765e9.26.1725899546518; Mon, 09 Sep 2024 09:32:26 -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.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 09:32:26 -0700 (PDT) From: =?UTF-8?q?Michal=20Koutn=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=20Koutn=C3=BD?= , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , Chen Ridong Subject: [PATCH 2/4] cgroup/cpuset: Expose cpuset filesystem with cpuset v1 only Date: Mon, 9 Sep 2024 18:32:21 +0200 Message-ID: <20240909163223.3693529-3-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The cpuset filesystem is a legacy interface to cpuset controller with (pre-)v1 features. It makes little sense to co-mount it on systems without cpuset v1, so do no build it when cpuset v1 is not built neither. Signed-off-by: Michal Koutn=C3=BD Reviewed-by: Waiman Long --- kernel/cgroup/cgroup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index c72e18ffbfd82..90e50d6d3cf39 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -2331,7 +2331,7 @@ static struct file_system_type cgroup2_fs_type =3D { .fs_flags =3D FS_USERNS_MOUNT, }; =20 -#ifdef CONFIG_CPUSETS +#ifdef CONFIG_CPUSETS_V1 static const struct fs_context_operations cpuset_fs_context_ops =3D { .get_tree =3D cgroup1_get_tree, .free =3D cgroup_fs_context_free, @@ -6236,7 +6236,7 @@ int __init cgroup_init(void) WARN_ON(register_filesystem(&cgroup_fs_type)); WARN_ON(register_filesystem(&cgroup2_fs_type)); WARN_ON(!proc_create_single("cgroups", 0, NULL, proc_cgroupstats_show)); -#ifdef CONFIG_CPUSETS +#ifdef CONFIG_CPUSETS_V1 WARN_ON(register_filesystem(&cpuset_fs_type)); #endif =20 --=20 2.46.0 From nobody Sat Feb 7 03:52:20 2026 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 05EF11667F1 for ; Mon, 9 Sep 2024 16:32:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725899551; cv=none; b=iQHtThLklytegdoZ42WLByDucmkXzacb4GCFZc4AwCrtJaGBpIR53kHhiSeGFOFpUIgLugqFHJlonkuJjBIzE9Wip/1Q03pzgYL9I3Bjwf59UUJFLeU+a/regMhUng445GV185zdq2sxqVW5gDf36OguxXK2qlgwqQ4VUQSRBPY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725899551; c=relaxed/simple; bh=+jtKQ79qkwGmLZ8LQTtUxHvnXR3dvvYB7R64gvm9pY0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AEEv6+UO8Wk/uufhFjy869D0whRFIvTCajYWbhdrW9evikT0N9yEtb7o3nIf//4+NPOVShn6u2Sci4t7NdLWYfNI7+tEsiBRuVgAyO3JcUsvuxp9NxrmGYVXOIP1fZ0lza5ZUX5gLXsFBRIarMrqjT0odYxFOp7mwiCVCFzkEUA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=FskJ6rvq; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="FskJ6rvq" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-428e0d184b4so39201955e9.2 for ; Mon, 09 Sep 2024 09:32:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1725899547; x=1726504347; darn=vger.kernel.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=3hN1sbdsSr5xjIEEi3K2BOZrBarvDPImrotZrDBVesU=; b=FskJ6rvqV30OtSq5ORuDrKCtWIsRsc0tXF7IEf2hODbR3mflHq2pG7cUyrPIosnYA8 2h7Ic1tgRdK+lMUaN6qcSPdM8xL5cnzzGf2nV2FIlKBXdsP6FMx116HOv+b4PYSaAcws Ebvr31DGnXeKLnTolVvFqT/bUE8eCdRmvPO6PW/2VEPD/fS6QUfWaXS2s6LbHBBkTGiL 7XhgCyoC1B0oSFq9EWZsXrRR0cXL/c6Iu3YrUBaGdGTAKkWuGu7a9aptd4mWBPVXLW3Q n0vv+EyMbMHdIXXdZgWH/p5JJwV0hsRY0DdnZJwQMkD4L7VXUOIiVxGprAYhrNekxjl1 PI/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725899547; x=1726504347; 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=3hN1sbdsSr5xjIEEi3K2BOZrBarvDPImrotZrDBVesU=; b=nwSPcYsDsLanucLjibCA/o1naDD1bh9Z15YrI/e5A/84bxLlg6QtHdSjs3uIrvvp+F +r6wPylh9BH9oz+TV0JI6+GzpNOGhECcvISshhod4pwUK1eKYGZaHdENOSqhHbjScUl0 78JBKJ3vfBZWp6Fl4Zb5FbhkaaPJdz/dG2fTE9o/cXM+8rhaOBSPNLXNN5uh/PEvc2Ja XYJpyeTI0smDWebebbkXDh1ksGyHvXjA9p+ML0itygbhgl/X+uGLHNXrYzdjP7EbW/5H +WJT/UayfihzSOGKr1NlBNc/8+FmcP7sgMQ030hblCGEifGdFNT8nVHxxZTNGvGBcGWY 65yw== X-Forwarded-Encrypted: i=1; AJvYcCXcy2LZoxZ+2KHMXI/tinPyJUPsaIhDeQBKNrDAvZF+OarAR+m76nE6X+C/Kwo8L9T7iVUwcZO7nWscvoc=@vger.kernel.org X-Gm-Message-State: AOJu0YwHhrGWvTsD2IZqDU17JrW3DwyTupQIUO0Bx/qt8wU3mK+7juXd 77LzzShi+JsXkBcREL2DHIITeqDwxYbQOA88RIQ1TQAvZCtkZ8PQ/UQDoGdKu74= X-Google-Smtp-Source: AGHT+IGxjAbrDtFXLx+iO1e9KJ4se6OA7eld34L5kuJJJmD5mvX5+Dcs4EKLQGfBldRlsEeQGM6bsA== X-Received: by 2002:a05:600c:1e02:b0:42c:b949:328e with SMTP id 5b1f17b1804b1-42cb949341dmr21798805e9.31.1725899547259; 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.26 (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=20Koutn=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=20Koutn=C3=BD?= , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Andrew Morton , Chen Ridong Subject: [PATCH 3/4] cgroup: Disallow mounting v1 hierarchies without controller implementation Date: Mon, 9 Sep 2024 18:32:22 +0200 Message-ID: <20240909163223.3693529-4-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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The configs that disable some v1 controllers would still allow mounting them but with no controller-specific files. (Making such hierarchies equivalent to named v1 hierarchies.) To achieve behavior consistent with actual out-compilation of a whole controller, the mounts should treat respective controllers as non-existent. Wrap implementation into a helper function, leverage legacy_files to detect compiled out controllers. The effect is that mounts on v1 would fail and produce a message like: [ 1543.999081] cgroup: Unknown subsys name 'memory' Signed-off-by: Michal Koutn=C3=BD --- kernel/cgroup/cgroup-v1.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c index b9dbf6bf2779d..784337694a4be 100644 --- a/kernel/cgroup/cgroup-v1.c +++ b/kernel/cgroup/cgroup-v1.c @@ -46,6 +46,12 @@ bool cgroup1_ssid_disabled(int ssid) return cgroup_no_v1_mask & (1 << ssid); } =20 +static bool cgroup1_subsys_absent(struct cgroup_subsys *ss) +{ + /* Check also dfl_cftypes for file-less controllers, i.e. perf_event */ + return ss->legacy_cftypes =3D=3D NULL && ss->dfl_cftypes; +} + /** * cgroup_attach_task_all - attach task 'tsk' to all cgroups of task 'from' * @from: attach to all cgroups of a given task @@ -932,7 +938,8 @@ int cgroup1_parse_param(struct fs_context *fc, struct f= s_parameter *param) if (ret !=3D -ENOPARAM) return ret; for_each_subsys(ss, i) { - if (strcmp(param->key, ss->legacy_name)) + if (strcmp(param->key, ss->legacy_name) || + cgroup1_subsys_absent(ss)) continue; if (!cgroup_ssid_enabled(i) || cgroup1_ssid_disabled(i)) return invalfc(fc, "Disabled controller '%s'", @@ -1024,7 +1031,8 @@ static int check_cgroupfs_options(struct fs_context *= fc) mask =3D ~((u16)1 << cpuset_cgrp_id); #endif for_each_subsys(ss, i) - if (cgroup_ssid_enabled(i) && !cgroup1_ssid_disabled(i)) + if (cgroup_ssid_enabled(i) && !cgroup1_ssid_disabled(i) && + !cgroup1_subsys_absent(ss)) enabled |=3D 1 << i; =20 ctx->subsys_mask &=3D enabled; --=20 2.46.0 From nobody Sat Feb 7 03:52:20 2026 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C718716B75C for ; Mon, 9 Sep 2024 16:32:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725899551; cv=none; b=m4vQ0E5jX+3jtHr+iuRzriJLNa9nJzQ+Cth6FT7Gr+QA6uT6MaDHc4OX94Y+qim+mX1tVcgoIXz8pUpI4yg3gP0WbhiDeCTJ4WDw5KNs1LnBAhSFd7Mf1rk1XMJkzxp9u6XQMeDtwm2EoTcIipdd8HgraD984IqAzFsBhgpJFX0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725899551; c=relaxed/simple; bh=6q24Sp43zvOQTSTocJSxRysPj4M+BbhTWRuqYELVHXs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CwtVJNoh0VaOl1AKw9yR+lGgDU+cxrai0mvZpIGh7nZPBtm7oxb0ZNHLPkRoAqcc74LmXNTEhqCHF/ekb2SkLKXMTidO9aREvnCTf+4McC75whBdnXhPQ1P3DVc2qG9WM5cEkgZ2TI5EFKCz67aFm/jj5t5pY/gq+1bnLV8SkbY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=MpjFeQ6t; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="MpjFeQ6t" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-42cba0dc922so6846535e9.3 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=vger.kernel.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=MpjFeQ6tRlXW3eQz59/Wu+XipbKWGHlmoKSsMNvcQJrFeuNtPTh44sfQCungAoin26 ARlX8wMn3v9nrqOST06wscoWNVc8znIu1kYhOvfIjyohOHIOgUoWqsFYYLx4N51I6Fsb /lDQ1FTe6ObM4jruhdyc3XT/aJRvgaXBYua5NaHRddp9rjpVqZ15sGWfsnWEA64mJbLt 64W7Gd4qNJi353cZ7CnI1PhmKCIQ6jQge1FPgOjlQw3b8g4pTRy4nZSJv+6fgKtkdDzp W+B49TAehdcOATFpxUQQRa0mezrO8QJ2dusQ1FEk/5bJOij/WLtKYLIGaMhgtJbJYxGm au/A== 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=aHrfqk+9hrQddmd5WxBJA5drqZCZ3b5oze7o38T5IiVpANtidvJqeOTbfqPdXJXJgR cWDa/uFJGOeLi4omrxzw2xfex+d+/qiJY+vn6ga0ccFmIfTq+6Dyfx2mjmK27ZVmzm1D CjvQ2hIfzXMDMJ9xIKrRd+mmnEnku1UwCCXE9ch5W1wHO/Lb0Ca11N81LmvJeExy3UvD gFNrlOZRX6wqHEN1SdL7CvKRpsKF1Y0tMaQPXRL/WvtvSLHb4D3DBr+NR+m/4ZnTbGl7 X99Pds7DMQpr1KmIpwdRHV2M3mF/olBTEtUtWF8dYfub0DxxvZhoVGuxPA7Asoj9pTGI ENQA== X-Forwarded-Encrypted: i=1; AJvYcCWSpQ/DjzARipq9DGo4px7dvMK+RMHkkh61+yKpw3W/Qduxws+k7g0uTwCORTa0kiEDMt7TbG5Whbf71Zw=@vger.kernel.org X-Gm-Message-State: AOJu0Yz0lf06m9J6WoXnoVy98VoZXhnh6+cOzUw/xrlVISUYOaU+K7Fi BInQ5zqVzk7epFvegLW104MQ2jnQVzg36mE57OMV2e9VUCr8qSfWAmFNPYS4lRs= 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=20Koutn=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=20Koutn=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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=C3=BD 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. */ =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 2.46.0