Re: [PATCH v14 09/24] fs/resctrl: Remove redundant calls to resctrl_mon_capable()
From: Luck, Tony
Date: Tue Oct 20 2026 - 11:56:46 EST
Hi Chenyu,
On Tue, Oct 20, 2026 at 09:38:41PM +0800, Chen Yu wrote:
> Hi Tony,
>
> On Mon, Oct 19, 2026 at 01:50:16PM -0700, Tony Luck wrote:
> > resctrl_mon_capable() reports whether the system supports monitoring by
> > scanning all resources. On x86 it used to read a single architecture-provided
> > flag. Calls on paths that run repeatedly now pay for the scan.
> >
> > Two such callers already know that monitoring is supported:
> >
> > 1) mbm_handle_overflow()
> > The MBM overflow handler runs once per second on each L3 monitoring
> > domain. It is only set up when MBM events are enabled, which requires
> > L3 monitoring support.
> >
>
> There is also a resctrl_mon_capable() check in mbm_setup_overflow_handler(),
> do we need to remove it too? But it is only called once in mbm_setup_overflow_handler(),
> leave it as it is should be OK.
Yes. I was only worried about calls in hot code paths. This call can
happen more than once if CPU hotplug removes and adds a domain. But
that's still not a hot code path.
>
> > 2) is_rmid_match()
> > Called for every task in the system when walking the task list to read
> > a tasks file, remove a group, or unmount. It only matches MON groups,
> > which can only be created on a system that supports monitoring.
> >
> > Remove the call to resctrl_mon_capable() from both functions.
> >
> > No functional change intended.
> >
> > Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>
> >
>
> Reviewed-by: Chen Yu <yu.c.chen@xxxxxxxxx>
Thanks for the review.
>
> thanks,
> Chenyu
-Tony