Re: [PATCH v10 RESEND 01/15] fs/resctrl: Return -EBUSY when per-CLOSID RMIDs are in limbo
From: Ben Horgan
Date: Mon Oct 26 2026 - 10:05:19 EST
Hi Jinjie,
On 20/10/2026 14:42, Jinjie Ruan wrote:
> resctrl_find_free_rmid() returns ERR_PTR(-ENOSPC) when no matching RMID
> is found in the free list. On systems where RMIDs depend on CLOSIDs
> (CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID), the target CLOSID may have RMIDs
> temporarily in limbo rather than permanently exhausted.
>
> When userspace attempts to create a new monitoring group, a permanent
> -ENOSPC failure prevents retry even though the CLOSID's RMIDs may become
> available once the limbo handler completes.
>
> Check closid_num_dirty_rmid[] before returning -ENOSPC. If the target
> CLOSID has dirty RMIDs, return -EBUSY to signal a retryable condition.
>
> Fixes: c4c0376eefe1 ("x86/resctrl: Allow RMID allocation to be scoped by CLOSID")
> Cc: James Morse <james.morse@xxxxxxx>
> Cc: Reinette Chatre <reinette.chatre@xxxxxxxxx>
> Cc: Babu Moger <babu.moger@xxxxxxx>
> Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>
> ---
> fs/resctrl/monitor.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c
> index 73413cb128ea..da883adc3adc 100644
> --- a/fs/resctrl/monitor.c
> +++ b/fs/resctrl/monitor.c
> @@ -225,6 +225,14 @@ static struct rmid_entry *resctrl_find_free_rmid(u32 closid)
> return itr;
> }
>
> + /*
> + * If this CLOSID has RMIDs in limbo, return -EBUSY so userspace can
> + * retry. Otherwise, the CLOSID is genuinely out of RMIDs.
> + */
> + if (IS_ENABLED(CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID) &&
> + closid_num_dirty_rmid[closid])
> + return ERR_PTR(-EBUSY);
> +
> return ERR_PTR(-ENOSPC);
> }
>
This seems like a sensible change to me. I ran into this myself the other day. For both cases the
last_cmd_status is "Out of RMIDs".
On a related, I have a patch, which I need to dig out and post, to add a flag so that the user can
know from the resctrl interface alone the maximum number of monitor groups can be created in a given
control group. It just displays the value of CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID in
info/mon_id_includes_control_id.
For this patch of yours, and the next one, it would be good to post them with a series title with
the prefix 'fs/resctrl:' so that they are easily seen to be generic resctrl changes and discoverable
by the resctrl maintainers.
Thanks,
Ben