Re: [PATCH] cgroup: replace BUG_ON()s in compare_css_sets() with WARN_ON_ONCE()

From: Tejun Heo

Date: Thu Nov 05 2026 - 11:20:17 EST


On Thu, Nov 05, 2026 at 08:48:13PM +0800, Shaojie Sun wrote:
> compare_css_sets() walks the cgrp_links lists of two css_sets in
> lockstep. Both lists carry exactly one link per hierarchy root, so a
> length or ordering mismatch just means the two css_sets are not the same
> one, which is what the function already reports with "return false".
> The caller keeps walking the hash chain and allocates a new css_set if
> nothing matches.
>
> None of these checks is a user-reachable error path; they are invariant
> checks on kernel-internal bookkeeping that are expected never to fire,
> and each one has a way out.
>
> No functional change for a consistent state.

Why are we changing this now? These never fired, and if they ever fire,
we're in a very deep doodoo.

Thanks.

--
tejun