Re: [PATCH v12 09/25] fs/resctrl: Remove redundant calls to resctrl_{alloc,mon}_capable()
From: Reinette Chatre
Date: Thu Sep 24 2026 - 11:36:27 EST
Hi Tony,
On 9/16/26 4:13 PM, Tony Luck wrote:
> resctrl_mon_capable() indicates whether any monitoring resources
> are enabled on the system. It does this by scanning all resources.
>
> Redundant calls to resctrl_mon_capable() in hot code paths should
> be eliminated. There are two prime examples:
All of the context is still just focused on resctrl_mon_capable() while
this change expanded its scope to also include resctrl_alloc_capable().
The resctrl_alloc_capable() change does not fall into the "redundant"
(per subject and in changelog) category though but is a user visible bugfix.
Considering this, should it be an explicit fix (with "Fixes:" tag) at
the beginning of the series?
>
> 1) mbm_handle_overflow()
> This function is called once per second from worker threads running on
> each L3 domain. resctrl_mon_capable() is clearly redundant because worker
> threads are only created if the MBM monitoring feature is enabled.
>
> 2) is_rmid_match()
> This is called for every task on the system so making it less expensive is
> appealing. resctrl_mon_capable() is redundant because the function also
> checks "r->type == RDTMON_GROUP" and this type of group can only be created
> on systems that support monitoring.
>
> 3) is_closid_match()
> The call to resctrl_alloc_capable() is not just redundant, it is wrong.
> On systems that only support monitoring it results in no tasks reported
> in the "tasks" file of the resctrl root directory.
Thank you for catching this and including the fix.
>
> Remove the call to resctrl_{alloc,mon}_capable() from each of these functions.
>
> Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>
> ---
Patch looks good to me.
Reinette