Re: [PATCH v13 10/25] fs/resctrl: Remove redundant calls to resctrl_mon_capable()
From: Chen Yu
Date: Mon Oct 19 2026 - 13:40:10 EST
Hi Tony,
On Mon, Sep 28, 2026 at 03:14:54PM -0700, 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:
>
> 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.
Nit: since patch 7 turns resctrl_mon_capable() into a resource scan and this
patch then drops it, would it be worth moving this patch before patch 7 so
there's no intermediate window between these two commits where these callers
pay the extra cost?
thanks,
Chenyu
> 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.
>
> Remove the call to resctrl_mon_capable() from each of these functions.
>
> Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>