Re: [PATCH v10 03/17] fs/resctrl: Remove redundant calls to resctrl_arch_mon_capable()

Reinette Chatre <[email protected]>
Newsgroups dev.linux.lists.patches,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Hi Tony,

On 7/29/26 10:27 AM, Tony Luck wrote:
> Architecture code provides resctrl_arch_mon_capable() so that file
> system code knows whether any monitor features are supported. This
> is used to decide whether to create "mon_data" directories etc.
> 
> Initially resctrl_arch_mon_capable() was an inline function providing
> the value of the x86 architecture variable "rdt_mon_capable". I.e.
> extremely low overhead and so it was used liberally as a sanity check.
> 
> The ARM implementation of resctrl_arch_mon_capable() is not inline and
> chases a couple of pointers. Future changes to x86 implementation will
> also make resctrl_arch_mon_capable() more expensive.
> 
> Redundant calls to resctrl_arch_mon_capable() in hot code paths should
> be eliminated.
> 
> 1) mbm_handle_overflow()
> This function is called once per second from worker threads running on
> each L3 domain. The call is clearly redundant because worker threads are
> only created if the MBM monitoring feature is enabled.
> 
> 2) is_rmid_match()
> This function is called when a user reads a "tasks" file of a MON_GROUP.

Above sentence can just be dropped since it is incomplete wrt where is_rmid_match()
is used. If you want to add a motivation it may be supportive to mention
that all callers of is_rmid_match() call it for every task on the system so
making it less expensive is appealing.

> The call 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_arch_mon_capable() from both of these
> functions.
> 
> Signed-off-by: Tony Luck <[email protected]>
> ---

| Reviewed-by: Reinette Chatre <[email protected]>

Reinette
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.