From nobody Sun Feb 8 09:32:24 2026 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) (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 7699334EEE7 for ; Wed, 17 Dec 2025 16:28:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.66 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765988885; cv=none; b=ImfoWmfIMS5gQ2RPT+gUC5gP8AI50COrS5/OpJT1hc0kFhfzSr+0Rob93bSaG92WTDXHcge6gZWWfLaBTT2xf7Zq1AdnYLycUnGM7Pnh8heyK1yj803EHBvTg5/74tgMd5OxCM1cQdOge3GDJyqewmV2PtZ5ednpMhpOid1WNMk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765988885; c=relaxed/simple; bh=8N1NH3gvQgT8EJmKCkddKOj6r6h0v+SQdz9mI6/X5NU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GUjnLE8HzWuX4DuF1cy1V5BM0vS02AtMHY27ysXl9AFsiDgblmkqaUMyhtQO0BqrvvrZbVtWKg1FuYoiNPeO67jOZRL6dZSsZLj3djh1CBFUAao6Qe4yNo1bX11hrODVIsqfZrDLgyDH3p6x64cTxQyVGNkKqGMQTJ4YTvC6atY= 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=YSQRfYX4; arc=none smtp.client-ip=209.85.128.66 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="YSQRfYX4" Received: by mail-wm1-f66.google.com with SMTP id 5b1f17b1804b1-4775e891b5eso26310805e9.2 for ; Wed, 17 Dec 2025 08:28:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1765988881; x=1766593681; 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=miS4ss3MDPMSZCVnSoPtKejAYQtVb4qQrc+Jf4/2A6E=; b=YSQRfYX43BQLOzgtpGn5en6mTceK+gUxvdgrUcw/54adk0PAT0twU1rfpNw+LkihDZ xLF9+30DAM8bH9PAdRvaQomTw30Og8NBHsKo4o0ng1fvrxdoTV15+tWb2ZMv8rEFeW0S m3JlE13pXes0pP7tyvbIQqgCZaZ/1qAPXlitL5An5t9knJKSaWg1zwoL+TDE3WuzfoV9 lJ8NoN8cnhdplXHsxGeLhWzRda+WKUKsqHrBke2Jbl9osrkKLdEuV4HAaE9millgRKS4 QsYkKhnT8PvCbnBwCnsrzgHRK76OHdWzkaFREPO1W7FtM7FnpHKKnCy69lOCcUvrxU1A sTFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765988881; x=1766593681; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=miS4ss3MDPMSZCVnSoPtKejAYQtVb4qQrc+Jf4/2A6E=; b=kHSMyF+abyGIFyQyNsl9+jM5VYPlYXDGateq/ihQuynxssytN/KAdUxq2jwNP+IaCY zYt8qJBoyDDtwv5nk0jacveS//Up+83bk8KfC8fpB/bnK+2eQNGt+EjUveLXWLU928br MS0jq9tfcQ4itjBHLvp30hbsGbM2+TcxMIGS21DnzHaWsGX/hCkyFqeCdZiYevxpMlmf +3GgHgCxXtj2vlOogH+vb4sE6YkSK4OaRIykFT8h4e4RYVF6sfRHjCVX1yENed73tKf2 F0oav+c6RN3aI4UWDCT7/adnlJTltW06Pz/oqmCkKGY7/QWOJiw+wkdrvREU5ieSPqd+ VO2Q== X-Forwarded-Encrypted: i=1; AJvYcCW0XroKKRmqnaZsoxbhgeoC8AXBvL8byyX/8yAQ9qJccZnUjQm41wy29QsdgYBMq0x/kIslYmRLe1CsK9A=@vger.kernel.org X-Gm-Message-State: AOJu0YwBT7VTAkDE13dOFoaRLtnRtwzUySTynPzfWvFi6J8FqpQXkJWO 1hwG9aeSf1P5a6zx4OTbO1QGyLu5Xboz6wLJHM3UBy8u64ULvKQ55CtOUneVYRPsPLw= X-Gm-Gg: AY/fxX4k+2Whf5zEz6+b7umLU7Pae9whDyKurTzbbthH/Sone5QVs0k11+xAxU79ncq f6APjjFI1wOpQe9qzPI4zPG5VwSqhoH6jCiVMwq4A30/rjjkiz/Rm1F90ofq9QaD592DiwP488m MFm0XGn0pGBm1xhIgsyx+YxIjV0ZotCbdpcbxHjrgT9nGqZ9ZyMJrD6T5C+iq8FJJXd8KSPGFen 4TTcmLPH5LT52EwXQL0F5DqopEqs+13nn2+lb/jgkNd+grRDA16gGG/zQbq4JRyMIV1x2YDPk4V 3QkGbWegHeB3cStc81FxJ6GzPQRvQlssshv9z7QpgYXsi5Tfk/pxwczWfsE3FuMrr3fmVO2qAJf PY01NxcpFfkDs+MHzujCpBvN2KEYTKGFjd7cT/RAk/0qbbRcf2Cj3BTMN9w6PkMgHfDzdaTnItq hnB6m5Z4GdKVUOglPYOY/50tbuCAshKm4= X-Google-Smtp-Source: AGHT+IHcvkh1m9sLAXyNB6eVc7R+7YZBCQwqFGtWv5JoMxfuEBVtQKc5wQlBYiBzOLEKXZOB0xl9aw== X-Received: by 2002:a05:6000:240d:b0:431:9b2:61dd with SMTP id ffacd0b85a97d-43109b2636cmr5805555f8f.38.1765988881299; Wed, 17 Dec 2025 08:28:01 -0800 (PST) Received: from blackdock.suse.cz (nat2.prg.suse.com. [195.250.132.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4310adeee0esm5728364f8f.29.2025.12.17.08.28.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Dec 2025 08:28:00 -0800 (PST) From: =?UTF-8?q?Michal=20Koutn=C3=BD?= To: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Michal=20Koutn=C3=BD?= , "Gustavo A. R. Silva" , David Laight , Tejun Heo , Johannes Weiner Subject: [PATCH 1/4] cgroup: Eliminate cgrp_ancestor_storage in cgroup_root Date: Wed, 17 Dec 2025 17:27:33 +0100 Message-ID: <20251217162744.352391-2-mkoutny@suse.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251217162744.352391-1-mkoutny@suse.com> References: <20251217162744.352391-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 cgrp_ancestor_storage has two drawbacks: - it's not guaranteed that the member immediately follows struct cgrp in cgroup_root (root cgroup's ancestors[0] might thus point to a padding and not in cgrp_ancestor_storage proper), - this idiom raises warnings with -Wflex-array-member-not-at-end. Instead of relying on the auxiliary member in cgroup_root, define the 0-th level ancestor inside struct cgroup (needed for static allocation of cgrp_dfl_root), deeper cgroups would allocate flexible _low_ancestors[]. Unionized alias through ancestors[] will transparently join the two ranges (ancestors is wrapped in a struct to avoid 'error: flexible array member in union'). The above change would still leave the flexible array at the end of struct cgroup, so move cgrp also towards the end of cgroup_root to resolve the -Wflex-array-member-not-at-end. Link: https://lore.kernel.org/r/5fb74444-2fbb-476e-b1bf-3f3e279d0ced@embedd= edor.com/ Reported-by: "Gustavo A. R. Silva" Closes: https://lore.kernel.org/r/b3eb050d-9451-4b60-b06c-ace7dab57497@embe= ddedor.com/ Cc: David Laight Signed-off-by: Michal Koutn=C3=BD Acked-by: Gustavo A. R. Silva --- include/linux/cgroup-defs.h | 28 +++++++++++++++++----------- kernel/cgroup/cgroup.c | 2 +- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h index b760a3c470a56..9247e437da5ce 100644 --- a/include/linux/cgroup-defs.h +++ b/include/linux/cgroup-defs.h @@ -626,7 +626,16 @@ struct cgroup { #endif =20 /* All ancestors including self */ - struct cgroup *ancestors[]; + union { + struct { + void *_sentinel[0]; /* XXX to avoid 'flexible array member in a struct = with no named members' */ + struct cgroup *ancestors[]; + }; + struct { + struct cgroup *_root_ancestor; + struct cgroup *_low_ancestors[]; + }; + }; }; =20 /* @@ -647,16 +656,6 @@ struct cgroup_root { struct list_head root_list; struct rcu_head rcu; /* Must be near the top */ =20 - /* - * The root cgroup. The containing cgroup_root will be destroyed on its - * release. cgrp->ancestors[0] will be used overflowing into the - * following field. cgrp_ancestor_storage must immediately follow. - */ - struct cgroup cgrp; - - /* must follow cgrp for cgrp->ancestors[0], see above */ - struct cgroup *cgrp_ancestor_storage; - /* Number of cgroups in the hierarchy, used only for /proc/cgroups */ atomic_t nr_cgrps; =20 @@ -668,6 +667,13 @@ struct cgroup_root { =20 /* The name for this hierarchy - may be empty */ char name[MAX_CGROUP_ROOT_NAMELEN]; + + /* + * The root cgroup. The containing cgroup_root will be destroyed on its + * release. This must be embedded last due to flexible array at the end + * of struct cgroup. + */ + struct cgroup cgrp; }; =20 /* diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index e717208cfb185..554a02ee298ba 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -5847,7 +5847,7 @@ static struct cgroup *cgroup_create(struct cgroup *pa= rent, const char *name, int ret; =20 /* allocate the cgroup and its ID, 0 is reserved for the root */ - cgrp =3D kzalloc(struct_size(cgrp, ancestors, (level + 1)), GFP_KERNEL); + cgrp =3D kzalloc(struct_size(cgrp, _low_ancestors, level), GFP_KERNEL); if (!cgrp) return ERR_PTR(-ENOMEM); =20 --=20 2.52.0 From nobody Sun Feb 8 09:32:24 2026 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.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 BA3CA3557F0 for ; Wed, 17 Dec 2025 16:28:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765988888; cv=none; b=J78tpeWUkAdaxr9zBT0OwNrEqw4TjtD+ebe+R0kS4wpd3nVfLc8shaCsVSGv9vJPKBe62paZn58X8l1SA2F9njgZnxA0k/HDG2ZAs0eN1OfWsHe0R6Pf1rzvDM33lt/xrAYaas+uqt+RfnPfJqGPKYpiioFgP0jYPvz8p1+G6TM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765988888; c=relaxed/simple; bh=jqBZIn02NWMcecKP606Y1uEX4V9j1/cIbAV2uLmFwFc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FTaw8Vlb1uzKyEIu0AVjxXN0cLM0akCPreh4qSTnNwRnm7u7cH525MxoSTIzfCPqwULn/NUlMRbpudYFNQ055j/Od8+CXpYYR5/OTwhGavECnlynfw+4HdVmFeidcG0IWCFOxedCUS1kRSQU+YxjDl4Lj5mGv7+vHU0Z2qiNOTk= 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=g0nSmNmP; arc=none smtp.client-ip=209.85.221.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="g0nSmNmP" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-42fb0fc5aa9so2418016f8f.1 for ; Wed, 17 Dec 2025 08:28:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1765988884; x=1766593684; 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=D5p3p8kAejxs1YQJhv0WnbRr/UVt3w2bGs3E+oMVl6E=; b=g0nSmNmPe0I1hSFsbHvi4tSbETWwrYGb7BvgFGNOZA6f9X+Eq/sAZkF7l8espN3o9L TjHpmufh5VcGptfW1SM5uHG5sa60ZQdS3yiJOmn4Xygh5wvlq6s0oyQZRcVr8tPEXHWe klSU8aGYAEe9BWAP180QufjkwUmjvyZJd65JZ4yx0EoJvlMWHhwEFHhMSESVX70hR8SR j71mbpBqvQNiMcvMaEvtvlixYYrYdnq3gY/o8gyjVBErEAyl8zemnGymBzo/v7SDMy42 KY75AkOJgM5pzvBARcfyRRswG6D0wwyrgNMTun2Yp4qdS8mgCHwchnJjdsAyx1fN5ALe eElA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765988884; x=1766593684; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=D5p3p8kAejxs1YQJhv0WnbRr/UVt3w2bGs3E+oMVl6E=; b=dWKQnOrEyyaJp2HBPJ0ldFmF6TTT6SJoH8Mou9QbT9YBDp0cnBH6Vb33O758I4I/qy 001ZxUTuK/cZfQ5xGzUv0scYm/e7K2P24BZnceP0r/jfuZDwZ6pxSNYi/SU3ZZN6uUyV qy755eTRpXTSljs8GsXXKga37TKrCMcvCkjSKJ607pFUUPMtKAuLr423lPioD2abiYA4 lN4Yd5NXPPn8Oe5Cy9ldFR0+IWXsMGjlCHUKThn+6bo3MD1YMQK+h0AqIW3+WL/vhjbn q/QH6ovbvP0i0n9gzYotnLHlBYSmE/vODUCr2iYvn/jOizZWr/SoL1vsFMiGvUt8zX0O ebZA== X-Forwarded-Encrypted: i=1; AJvYcCVuztqCSQE9HPQ8f7MjOJAzB1RCmrH5EQul2SwmhDkZNhe46+AvdACZ6VGDc+J6QeiqYzlKMVNFpefWmWU=@vger.kernel.org X-Gm-Message-State: AOJu0YwHAq9S8CE+wYh4F0/JfTADh3ZVuqwOVHNlHWq1/jICYzq5R3EZ Ig7I9aAKd3yESxt65Pi5hMiAsi09o3TLG5+6gOWkRiJhAbUBNUsDb7LpAH+cRTsC1qA= X-Gm-Gg: AY/fxX65buwoW+TJxRh8wyZenwENxzz3sdQhZVOe09fVz/7YfkSCQNhVs4lv20Ki/kc VIqPMYXxlwMFoyjqY45+7au2cr2ZpEuHvMs+4pRx4M6Oq+BLf9yalCV7gUudxmjQV4E9+Q2g8Jl +rWYx24AbTpa6O1F4VY/FfejeKBBUxSKfSTAlcF9/87rRoXqK6jxW/kcGSEIjzCkdXYYc0STKsk EmVx1UfFDTtpokcirJivDJrbrIlv8qyl/kc4jPgQEiKx4DaZvUGn+84jh89XnLVLssbSq0NY7Vs 63K0r/fESPbKotHlIKLpPq7+ajyhIzVTjdFTS0tfNlVhpCmcnHW7PGy3ZdWJ5ykF8FYWnPLj0AD 43XAUt2xvMmEn4Cf6NlTGRZsu/a7WX7l16y4pq/FkIXRia9+MdNWVZ3FKp+Q5bRpzuzayy3mAV2 b63Fl6Y3PahL1EI4MYXoASK+A/cWPKgbw= X-Google-Smtp-Source: AGHT+IGpydpE/x5zxrviDhKfJqjEaKSG+Hi2wTDqQX9lTrcKDco/8aBmmWcByjoue9ZRozmJ4alpSw== X-Received: by 2002:a05:6000:186d:b0:431:5ca:c1b7 with SMTP id ffacd0b85a97d-43105cac2d6mr7328202f8f.23.1765988883910; Wed, 17 Dec 2025 08:28:03 -0800 (PST) Received: from blackdock.suse.cz (nat2.prg.suse.com. [195.250.132.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4310adeee0esm5728364f8f.29.2025.12.17.08.28.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Dec 2025 08:28:03 -0800 (PST) From: =?UTF-8?q?Michal=20Koutn=C3=BD?= To: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-trace-kernel@vger.kernel.org, bpf@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org Cc: =?UTF-8?q?Michal=20Koutn=C3=BD?= , Yu Kuai , Jens Axboe , Tejun Heo , Josef Bacik , Johannes Weiner , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , Phil Sutter , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman Subject: [PATCH 2/4] cgroup: Introduce cgroup_level() helper Date: Wed, 17 Dec 2025 17:27:34 +0100 Message-ID: <20251217162744.352391-3-mkoutny@suse.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251217162744.352391-1-mkoutny@suse.com> References: <20251217162744.352391-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 no functional change to hide physical storage of cgroup's level and it allows subesequent conversion of the storage. Signed-off-by: Michal Koutn=C3=BD --- block/bfq-iosched.c | 2 +- block/blk-iocost.c | 4 ++-- include/linux/cgroup.h | 18 +++++++++++++++--- include/trace/events/cgroup.h | 8 ++++---- kernel/bpf/helpers.c | 2 +- kernel/cgroup/cgroup.c | 4 ++-- net/netfilter/nft_socket.c | 2 +- 7 files changed, 26 insertions(+), 14 deletions(-) diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 4a8d3d96bfe49..f293bab068274 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -601,7 +601,7 @@ static bool bfqq_request_over_limit(struct bfq_data *bf= qd, goto out; =20 /* +1 for bfqq entity, root cgroup not included */ - depth =3D bfqg_to_blkg(bfqq_group(bfqq))->blkcg->css.cgroup->level + 1; + depth =3D cgroup_level(bfqg_to_blkg(bfqq_group(bfqq))->blkcg->css.cgroup)= + 1; if (depth > alloc_depth) { spin_unlock_irq(&bfqd->lock); if (entities !=3D inline_entities) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index a0416927d33dc..b4eebe61dca7f 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -2962,7 +2962,7 @@ static void ioc_cpd_free(struct blkcg_policy_data *cp= d) static struct blkg_policy_data *ioc_pd_alloc(struct gendisk *disk, struct blkcg *blkcg, gfp_t gfp) { - int levels =3D blkcg->css.cgroup->level + 1; + int levels =3D cgroup_level(blkcg->css.cgroup) + 1; struct ioc_gq *iocg; =20 iocg =3D kzalloc_node(struct_size(iocg, ancestors, levels), gfp, @@ -3003,7 +3003,7 @@ static void ioc_pd_init(struct blkg_policy_data *pd) init_waitqueue_head(&iocg->waitq); hrtimer_setup(&iocg->waitq_timer, iocg_waitq_timer_fn, CLOCK_MONOTONIC, H= RTIMER_MODE_ABS); =20 - iocg->level =3D blkg->blkcg->css.cgroup->level; + iocg->level =3D cgroup_level(blkg->blkcg->css.cgroup) =20 for (tblkg =3D blkg; tblkg; tblkg =3D tblkg->parent) { struct ioc_gq *tiocg =3D blkg_to_iocg(tblkg); diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index bc892e3b37eea..0290878ebad26 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -525,6 +525,18 @@ static inline struct cgroup *cgroup_parent(struct cgro= up *cgrp) return NULL; } =20 +/** + * cgroup_level - cgroup depth + * @cgrp: cgroup + * + * The depth this cgroup is at. The root is at depth zero and each step d= own + * the hierarchy increments the level. + */ +static inline int cgroup_level(struct cgroup *cgrp) +{ + return cgrp->level; +} + /** * cgroup_is_descendant - test ancestry * @cgrp: the cgroup to be tested @@ -537,9 +549,9 @@ static inline struct cgroup *cgroup_parent(struct cgrou= p *cgrp) static inline bool cgroup_is_descendant(struct cgroup *cgrp, struct cgroup *ancestor) { - if (cgrp->root !=3D ancestor->root || cgrp->level < ancestor->level) + if (cgrp->root !=3D ancestor->root || cgroup_level(cgrp) < cgroup_level(a= ncestor)) return false; - return cgrp->ancestors[ancestor->level] =3D=3D ancestor; + return cgrp->ancestors[cgroup_level(ancestor)] =3D=3D ancestor; } =20 /** @@ -556,7 +568,7 @@ static inline bool cgroup_is_descendant(struct cgroup *= cgrp, static inline struct cgroup *cgroup_ancestor(struct cgroup *cgrp, int ancestor_level) { - if (ancestor_level < 0 || ancestor_level > cgrp->level) + if (ancestor_level < 0 || ancestor_level > cgroup_level(cgrp)) return NULL; return cgrp->ancestors[ancestor_level]; } diff --git a/include/trace/events/cgroup.h b/include/trace/events/cgroup.h index ba9229af9a343..0a1bc91754b5e 100644 --- a/include/trace/events/cgroup.h +++ b/include/trace/events/cgroup.h @@ -67,7 +67,7 @@ DECLARE_EVENT_CLASS(cgroup, TP_fast_assign( __entry->root =3D cgrp->root->hierarchy_id; __entry->id =3D cgroup_id(cgrp); - __entry->level =3D cgrp->level; + __entry->level =3D cgroup_level(cgrp); __assign_str(path); ), =20 @@ -136,7 +136,7 @@ DECLARE_EVENT_CLASS(cgroup_migrate, TP_fast_assign( __entry->dst_root =3D dst_cgrp->root->hierarchy_id; __entry->dst_id =3D cgroup_id(dst_cgrp); - __entry->dst_level =3D dst_cgrp->level; + __entry->dst_level =3D cgroup_level(dst_cgrp); __assign_str(dst_path); __entry->pid =3D task->pid; __assign_str(comm); @@ -180,7 +180,7 @@ DECLARE_EVENT_CLASS(cgroup_event, TP_fast_assign( __entry->root =3D cgrp->root->hierarchy_id; __entry->id =3D cgroup_id(cgrp); - __entry->level =3D cgrp->level; + __entry->level =3D cgroup_level(cgrp); __assign_str(path); __entry->val =3D val; ), @@ -221,7 +221,7 @@ DECLARE_EVENT_CLASS(cgroup_rstat, TP_fast_assign( __entry->root =3D cgrp->root->hierarchy_id; __entry->id =3D cgroup_id(cgrp); - __entry->level =3D cgrp->level; + __entry->level =3D cgroup_level(cgrp); __entry->cpu =3D cpu; __entry->contended =3D contended; ), diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c index db72b96f9c8c8..b825f6e0a1c29 100644 --- a/kernel/bpf/helpers.c +++ b/kernel/bpf/helpers.c @@ -2577,7 +2577,7 @@ __bpf_kfunc struct cgroup *bpf_cgroup_ancestor(struct= cgroup *cgrp, int level) { struct cgroup *ancestor; =20 - if (level > cgrp->level || level < 0) + if (level > cgroup_level(cgrp) || level < 0) return NULL; =20 /* cgrp's refcnt could be 0 here, but ancestors can still be accessed */ diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index 554a02ee298ba..e011f1dd6d87f 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -5843,7 +5843,7 @@ static struct cgroup *cgroup_create(struct cgroup *pa= rent, const char *name, struct cgroup_root *root =3D parent->root; struct cgroup *cgrp, *tcgrp; struct kernfs_node *kn; - int i, level =3D parent->level + 1; + int i, level =3D cgroup_level(parent) + 1; int ret; =20 /* allocate the cgroup and its ID, 0 is reserved for the root */ @@ -5884,7 +5884,7 @@ static struct cgroup *cgroup_create(struct cgroup *pa= rent, const char *name, goto out_stat_exit; =20 for (tcgrp =3D cgrp; tcgrp; tcgrp =3D cgroup_parent(tcgrp)) - cgrp->ancestors[tcgrp->level] =3D tcgrp; + cgrp->ancestors[cgroup_level(tcgrp)] =3D tcgrp; =20 /* * New cgroup inherits effective freeze counter, and diff --git a/net/netfilter/nft_socket.c b/net/netfilter/nft_socket.c index 36affbb697c2f..a5b0340924efb 100644 --- a/net/netfilter/nft_socket.c +++ b/net/netfilter/nft_socket.c @@ -64,7 +64,7 @@ static noinline int nft_socket_cgroup_subtree_level(void) if (IS_ERR(cgrp)) return PTR_ERR(cgrp); =20 - level =3D cgrp->level; + level =3D cgroup_level(cgrp); =20 cgroup_put(cgrp); =20 --=20 2.52.0 From nobody Sun Feb 8 09:32:24 2026 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.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 651D835580B for ; Wed, 17 Dec 2025 16:28:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765988890; cv=none; b=iYY8v0Fge9yz1TusQdV68wgJyYKVpY4wZ1sFpkOLm57f9rw1Ojur0AlzE+8SAAoYlyLps3X6qHW79zmc9FV15I0F/Iu4V1+YeMfCzRUvLtK3qHMzz0CM3EpUQP2MmIY6SSE89N+RnVHEuoJR53+CRoLfS9OGJz56hQv/haw7BvQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765988890; c=relaxed/simple; bh=EiPp5UR3odiaNu3fVGfrz6bU9tX+nxjcHoSZdd3tcLs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=U9BEZqrLCmCTkORtd7B9E/TKvGMcRMAyffnhOMQo/eA9aTdrSq6k3YoZNpS/QeoHqGn10bFMR5HEPaTgfuA/g6N91ACw10kzib3hRL91yMAsK4sApWN4J+om8jeJFir+8QT5aT3197C3x4crxLp8xZluYsNhHfQud8d0CoUTMLs= 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=JGnvzqj6; arc=none smtp.client-ip=209.85.221.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="JGnvzqj6" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-42f9ece6387so2359759f8f.0 for ; Wed, 17 Dec 2025 08:28:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1765988886; x=1766593686; 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=nfQau0odZ8gUGBEhG5i1wvM039LCZUqSFw7CAdbRE6k=; b=JGnvzqj6iCYWKkJNPpK3HGmQrS0fjcwiSI+Vv6QjbjtyBBGiRrOvk0xJq4582XMBFp AF5XBJWEyPdY/TFBRUEUnpaZgs4gMigLgvwVUe8KFtMLBG1O8hec9w66FO0VNp4zOc9e PHSPcqfBlVF45d33W4IXj8acFy2ZCWV9qdsVS3d/r28BBYZDw6swgAxf9ymC+sN2QDJR umKtcGRKZpfUANCVuPyWm9wNAGgYLEvQGoQ/KFkDMpxHRQYasE0P1LC1cKJDdtRek46r NVl0k9Ut9nq7MkEhg77shQv5zm3mcEAbUo1yBdqQCmOLJhESqlk4U8iRZuhVQCj79+LQ MmgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765988886; x=1766593686; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=nfQau0odZ8gUGBEhG5i1wvM039LCZUqSFw7CAdbRE6k=; b=Uwn7VdpIpoNCAuLF9M+lZqTtAWYFCeGios5zjLLIBT1THNnGX6t18/Dhkt9tGemw5R gNxpaoi4S8nd4cddvrTN2D42wPjc9bmmAQpAAVG5hrTjyGk8zOT9vo7LKjCxAI3wr2Vp DkVRbUgK28esu3Lz86oXOm8ZB5vwp+iaYf6J4AOA2eKdIU4Nr1EsjfybfH0DXqVawRzt db6jFyBjZAJlKzcth/+Ebk/QzUvMNaF5Cs8IeGyMBEUtyaZKpM2lMSytDlozNh2X2k1K rSUg4X2vcZboFQV4BnAAov1UBvVYlNXICKbnZ92mIthJIwq1jehcOZPWSXfwaz2ppokz v/rQ== X-Forwarded-Encrypted: i=1; AJvYcCWYrEE4OXQxcwZqAizXquRXcgKWCNnIDmNUfitmm+ymHLfG3EUfI5LE3VSmrByY+xlKrTQvlHsN+HnkPUw=@vger.kernel.org X-Gm-Message-State: AOJu0YzbwzZ0wN3nynFRdnCM5O3fiC4GKoaEpflPLYoPk9TUMWGyRRfh vDsBExBG34gYcZnpsBpMrIZeCm+zCaPghFUJbRicAAtbGFpVNhMtlPUabCUOcW1USso= X-Gm-Gg: AY/fxX6AdHDPwFplQ2777gWLncNgeMjeQzKRpo1VqTtJm+z/68mfy6UD41DFoupCCso fzfdVX7DCFcS/osjf+3+oJlV9u3+iQZla9Ge11E6UWGJK1TLPE56/cHhElZBjM0z+qQp2dRHgu/ CU9gK9rIgbbH+WE0LSPTlwo8WIudEEbzebcH1x2eFdXoKfrWrT6GB7u5sDmnBj0aarIXE3/2mgB uy/J1VJUc7kFHs/edcLTVM+FvuRzQwQ5X/3caCFifnbMk3S0iZR/v4f5msB3nzpqDGWgXWzUzQo OI2aL+sUzU8p90/hlH7ff+EGq6pGR5d6gWXe8bYSQYqKA8vB1XGFgyCLzFPEuqcsa1uxHCQ7CTP uV14dEWy+tzH+meXJqq4ZtRsnZIrSmfjxdS2EhfDFHzQprRDSTRjD+cnV/r/dpaVI9tfFFV/SjH B6ZqOMSPVoV4SrrTmhy8d8wdD+63RqOAM= X-Google-Smtp-Source: AGHT+IEu4DI9WqCByr7rrTwLwlGd6tkHLE9xiBLfLuxbiSgJPjBw/xrcqlQOuJPymNtVyODbYOHj5A== X-Received: by 2002:a05:6000:26d0:b0:430:f790:99d7 with SMTP id ffacd0b85a97d-430f790ae20mr15969150f8f.27.1765988885518; Wed, 17 Dec 2025 08:28:05 -0800 (PST) Received: from blackdock.suse.cz (nat2.prg.suse.com. [195.250.132.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4310adeee0esm5728364f8f.29.2025.12.17.08.28.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Dec 2025 08:28:05 -0800 (PST) From: =?UTF-8?q?Michal=20Koutn=C3=BD?= To: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Cc: =?UTF-8?q?Michal=20Koutn=C3=BD?= , "Gustavo A. R. Silva" , Tejun Heo , Johannes Weiner , Kees Cook , "Gustavo A. R. Silva" Subject: [PATCH 3/4] cgroup: Use __counted_by for cgroup::ancestors Date: Wed, 17 Dec 2025 17:27:35 +0100 Message-ID: <20251217162744.352391-4-mkoutny@suse.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251217162744.352391-1-mkoutny@suse.com> References: <20251217162744.352391-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 cgroup::ancestors includes self, i.e. root cgroups have one ancestor but their level is 0. Change the value that we store inside struct cgroup and use an inlined helper where we need to know the level. This way we preserve the concept of 0-based levels and we can utilize __counted_by constraint to guard ancestors access. (We could've used level value as a counter for _low_ancestors but that would have no benefit since we never access data through this flexible array alias.) Cc: "Gustavo A. R. Silva" Signed-off-by: Michal Koutn=C3=BD --- include/linux/cgroup-defs.h | 19 ++++++++----------- include/linux/cgroup.h | 2 +- kernel/cgroup/cgroup.c | 3 ++- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h index 9247e437da5ce..8ce1ae9bea909 100644 --- a/include/linux/cgroup-defs.h +++ b/include/linux/cgroup-defs.h @@ -475,14 +475,6 @@ struct cgroup { =20 unsigned long flags; /* "unsigned long" so bitops work */ =20 - /* - * The depth this cgroup is at. The root is at depth zero and each - * step down the hierarchy increments the level. This along with - * ancestors[] can determine whether a given cgroup is a - * descendant of another without traversing the hierarchy. - */ - int level; - /* Maximum allowed descent tree depth */ int max_depth; =20 @@ -625,13 +617,18 @@ struct cgroup { struct bpf_local_storage __rcu *bpf_cgrp_storage; #endif =20 - /* All ancestors including self */ union { struct { - void *_sentinel[0]; /* XXX to avoid 'flexible array member in a struct = with no named members' */ - struct cgroup *ancestors[]; + int nr_ancestors; /* do not use directly but via cgroup_level() */ + /* + * All ancestors including self. + * ancestors[] can determine whether a given cgroup is a + * descendant of another without traversing the hierarchy. + */ + struct cgroup *ancestors[] __counted_by(nr_ancestors); }; struct { + int _nr_ancestors; /* auxiliary padding, see nr_ancestors above */ struct cgroup *_root_ancestor; struct cgroup *_low_ancestors[]; }; diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 0290878ebad26..45f720b9ecedd 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -534,7 +534,7 @@ static inline struct cgroup *cgroup_parent(struct cgrou= p *cgrp) */ static inline int cgroup_level(struct cgroup *cgrp) { - return cgrp->level; + return cgrp->nr_ancestors - 1; } =20 /** diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c index e011f1dd6d87f..5110d3e13d125 100644 --- a/kernel/cgroup/cgroup.c +++ b/kernel/cgroup/cgroup.c @@ -2197,6 +2197,7 @@ int cgroup_setup_root(struct cgroup_root *root, u16 s= s_mask) } root_cgrp->kn =3D kernfs_root_to_node(root->kf_root); WARN_ON_ONCE(cgroup_ino(root_cgrp) !=3D 1); + root_cgrp->nr_ancestors =3D 1; /* stored in _root_ancestor */ root_cgrp->ancestors[0] =3D root_cgrp; =20 ret =3D css_populate_dir(&root_cgrp->self); @@ -5869,7 +5870,7 @@ static struct cgroup *cgroup_create(struct cgroup *pa= rent, const char *name, =20 cgrp->self.parent =3D &parent->self; cgrp->root =3D root; - cgrp->level =3D level; + cgrp->nr_ancestors =3D parent->nr_ancestors + 1; =20 /* * Now that init_cgroup_housekeeping() has been called and cgrp->self --=20 2.52.0 From nobody Sun Feb 8 09:32:24 2026 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 D682E3559C9 for ; Wed, 17 Dec 2025 16:28:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765988891; cv=none; b=EKVaL5559tSOeaeObk3DtQX82mrEDYjZrUJjX45EHVQJF1XOWpl7B4GCgZpzfCYXhaVLD5p1/VGPJYluLy8fDTuAmyXem7gt1hUs2Ey78n3Xyiq+5DJJInWFrDNRwUfuEn0gNWB9VR0H7yPE4979ERBN5OGahJ3ROYOY8+9ctZ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765988891; c=relaxed/simple; bh=hHiQ13HsCnnPciHjNgpzJZ953n8TCFCJOtTwd/r8PoM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=K8RZeH3flq/4R0pmSYI4lGQVWMe4utNRSEfGPFzkKrjLyKsRsK/Tu2ubEut0okp17T/6lr4+G9IKF/6xxKG0YGuRrexroXYzFN2ce6F5KDr43pVXvJg+4OpboKyUa01T4rIPYylaIgKit9Ajhc+UTBFfYlf3Po/URG/VK1Q9aHM= 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=ZMi5D8fu; arc=none smtp.client-ip=209.85.221.43 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="ZMi5D8fu" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-42fed090e5fso2425343f8f.1 for ; Wed, 17 Dec 2025 08:28:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1765988887; x=1766593687; 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=xJElybK4r9OmuCr9uVdpcrBwONyPRzk09mZYQhniuJw=; b=ZMi5D8fu2ODKZpQGF1dOBw90mD2ODR5ig/yMm0KcbgkCLTaKc7hUdNzas614aB0+la ZOdRXudFavbdltCYbV90KhV0AHlhXQJxomZOFxqwm0qWWC8ZkUIuNY/2sqzcBQTKu2Ot cOU16w/Gfn1W1aGN6SzYtljEtJhE/vZgvFjnuLZhshDu704kAWXtENMSMFXK/VlE7OAa 2yFeN5Xyrl2iRm4AxNUHHMO1O91lyN8wpDgMflZOcAij5h2ZNP7fpc42mSmyDC76ekwR /jJRYLBKKan1IUtLdHd941qEcKgshI3HNqBM5V1tl3mvVQwng89xHSnW798Vu6HdMkf3 U0kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765988887; x=1766593687; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=xJElybK4r9OmuCr9uVdpcrBwONyPRzk09mZYQhniuJw=; b=CurbIjbuHEjHVl9gW8NBU3MjSH/IhzkfgiliIRdw1oJc0QjgdKCEos6iynpVGbvuOi 3l2Bux9Pjx/N3qgaQzZQ3G6NKth90zn4YOIW5N2/29mdeiKmUC4chg9LlNKmz/JTbnLg FWXD2B9R14A6/XXqH6kNC7L2JJ7s9VMx9rEhBq75Zr2PHKLk0JSTAe0vka8K2UK9oe0m S/9qK+JAVm0n6Sv2Gz+mMfJC17o3n0SZLkJ0Db1U1r/i0gLgz5G8Z6iFTF8EiTqP4h01 mmCG0viZfwyt+0dpmsFVFVDynq6rIQs2rlVTw0JJw5G4yPkojZzlRRZls3hbitbgD+SY YhfQ== X-Forwarded-Encrypted: i=1; AJvYcCVUjERDfq0cetBrDiLwdSAAE5j8mhugyccV+dtSlpZheo31NiBK5Cm4P/MTLT3PC0JEuSdwEeFLce6uRRo=@vger.kernel.org X-Gm-Message-State: AOJu0YxPCy1xyKqk84G68k8ZuSEdi62KRgM43H271pbBKjNjBf/R+mST CnXTbQQ9/jjXDj+lI5vVP3JnHS/UXQpAPQeXzvoc1FmNZjODke+1ImfQFAQz0kCpgeq7pqNIxfv +AUSQ X-Gm-Gg: AY/fxX5lj43kwGWUd8+4LeT9fPblqJBdifpVM2+mGmj00SFBY40QBZ1pseeIt3SLQb5 CWS54vu2EzqalBD6wPJa1dk56YekO9ErhZ49R1tGjDiHZ5VMhUZpkfUPyI68ZJDZEzrh0O3iK+k ZTGY2lEsp+A21aYKxTPclM5lhhiSOghozSj+fJYBzeLntWYSrw/4o5aAGRmtjywDB+7jY5etY+L 4hDqk/Tm2GsYV5FMaZKQQTtdnNzOSCVK2ejUR2CbWwhkYmRg7PqBEyOVOjPm6UV02gv6LQ6gqfe 3G2bDzzuZ/2ISfDNk9eMZVnfzJSmTuxl+K51MAALa7+6x1RODDtw8tfX6DndrliABV0luznj1et EYGT/Tys5VFzGs6wPhkwvNP2Z13VMwmuzYete7tCwQj0xZjvnDBZHiJyITK2O8anfmSklKdaLNn Putm9agYnflDoQbJajhBwZJdC6HxduBkk= X-Google-Smtp-Source: AGHT+IGbhlvyzEjuDTSV+fNvDCFi8GKeD7MdXF7NnWLDDEh5pN2MML+EtVLT61FA020HJ60pRPL1yg== X-Received: by 2002:a05:6000:22c3:b0:431:656:c726 with SMTP id ffacd0b85a97d-4310656ca9dmr6412349f8f.3.1765988886936; Wed, 17 Dec 2025 08:28:06 -0800 (PST) Received: from blackdock.suse.cz (nat2.prg.suse.com. [195.250.132.146]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4310adeee0esm5728364f8f.29.2025.12.17.08.28.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Dec 2025 08:28:06 -0800 (PST) From: =?UTF-8?q?Michal=20Koutn=C3=BD?= To: cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Cc: =?UTF-8?q?Michal=20Koutn=C3=BD?= , "Gustavo A. R. Silva" , Tejun Heo , Josef Bacik , Jens Axboe , Kees Cook , "Gustavo A. R. Silva" Subject: [PATCH 4/4] blk-iocost: Correct comment ioc_gq::level Date: Wed, 17 Dec 2025 17:27:36 +0100 Message-ID: <20251217162744.352391-5-mkoutny@suse.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251217162744.352391-1-mkoutny@suse.com> References: <20251217162744.352391-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 comment is simpler than reworking level users for possible ioc_gq::ancestors __counted_by annotation. Cc: "Gustavo A. R. Silva" Signed-off-by: Michal Koutn=C3=BD --- block/blk-iocost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index b4eebe61dca7f..c5e09ebae5ab0 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -545,7 +545,7 @@ struct ioc_gq { u64 indebt_since; u64 indelay_since; =20 - /* this iocg's depth in the hierarchy and ancestors including self */ + /* this iocg's depth in the hierarchy and ancestors excluding self */ int level; struct ioc_gq *ancestors[]; }; --=20 2.52.0