Re: [PATCH v5 13/16] fs/resctrl: Deactivate the kernel mode association when a group is removed

From: Reinette Chatre

Date: Wed Sep 16 2026 - 01:36:59 EST


Hi Babu,

On 8/26/26 12:32 PM, Babu Moger wrote:
> +/**
> + * rdtgroup_kmode_detach() - Detach @rdtgrp from a kernel mode association
> + * @rdtgrp: Resctrl group being removed or torn down.
> + *
> + * If @rdtgrp backs the active kernel mode association, disable the
> + * hardware association programmed for the group's kmode_cpu_mask,
> + * clear the associated kernel mode state, and restore
> + * RESCTRL_INHERIT_USER as the active mode.

I am not going to keep pointing these out but please check entire series
and remove all these verbatim code descriptions from function comments.

> + */
> +static void rdtgroup_kmode_detach(struct rdtgroup *rdtgrp)

Similar to previous comments this only seems relevant to the
global per-CPU kernel mode so function can be made specific to it.

> +{
> + if (!rdtgrp || !rdtgrp->kmode)
> + return;
> +
> + if (resctrl_kcfg.active.k_rdtgrp != rdtgrp) {

Related to comment in previous patch this double check of rdtgrp->kmode
and resctrl_kcfg.active.k_rdtgrp seems to support that only one is needed?

> + pr_warn("resctrl: kernel mode group not valid\n");

Please just fix this file's pr_fmt(fmt) instead.

> + return;
> + }
> +
> + rdtgroup_kmode_deactivate(rdtgrp);
> +
> + resctrl_kcfg.active.k_rdtgrp = NULL;
> + resctrl_kcfg.active.kmode_cur = RESCTRL_INHERIT_USER;
> + resctrl_kcfg.active.ctrl_mode = KMODE_INHERIT;
> + resctrl_kcfg.active.mon_mode = KMODE_INHERIT;
> +}
> +
> void *rdt_kn_parent_priv(struct kernfs_node *kn)
> {
> /*
Reinette