Re: [PATCH v11 06/23] arm,x86,fs/resctrl: Replace architecture resctrl_arch_{alloc,mon}_capable()
From: Reinette Chatre
Date: Wed Sep 09 2026 - 23:56:57 EST
Hi Tony,
On 8/31/26 10:44 AM, Tony Luck wrote:
> All the information to determine whether a system is alloc, or mon,
> capable is available to the file system. Architecture helpers are not
> needed.
>
> Define generic resctrl_alloc_capable() and resctrl_mon_capable() and
> replace all architecture versions.
>
> Suggested-by: Reinette Chatre <reinette.chatre@xxxxxxxxx>
> Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>
> ---
...
> diff --git a/include/linux/arm_mpam.h b/include/linux/arm_mpam.h
> index f92a36187a52..ba4131048260 100644
> --- a/include/linux/arm_mpam.h
> +++ b/include/linux/arm_mpam.h
> @@ -50,9 +50,6 @@ static inline int mpam_ris_create(struct mpam_msc *msc, u8 ris_idx,
> }
> #endif
>
> -bool resctrl_arch_alloc_capable(void);
> -bool resctrl_arch_mon_capable(void);
> -
> void resctrl_arch_set_cpu_default_closid(int cpu, u32 closid);
> void resctrl_arch_set_closid_rmid(struct task_struct *tsk, u32 closid, u32 rmid);
> void resctrl_arch_set_cpu_default_closid_rmid(int cpu, u32 closid, u32 rmid);
> diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
> index dd09c2ce9a0f..4a6b0c1833d6 100644
> --- a/include/linux/resctrl.h
> +++ b/include/linux/resctrl.h
> @@ -346,6 +346,32 @@ struct rdt_resource {
> */
> struct rdt_resource *resctrl_arch_get_resource(enum resctrl_res_level l);
>
> +/*
> + * resctrl_alloc_capable - Are any allocation resources enabled.
The description reads like a question but ends with a period.
> + */
> +static inline bool resctrl_alloc_capable(void)
> +{
> + struct rdt_resource *r;
> +
> + for_each_rdt_resource(r)
Please add brackets around this loop. For reference, see "Bracket rules"
in Documentation/process/maintainer-tip.rst.
> + if ((r)->alloc_capable)
Copied from the macro? Please drop parenthesis around r.
> + return true;
Please add empty line here.
> + return false;
> +}
> +
> +/*
> + * resctrl_mon_capable - Are any monitor resources enabled.
> + */
> +static inline bool resctrl_mon_capable(void)
> +{
> + struct rdt_resource *r;
> +
> + for_each_rdt_resource(r)
> + if ((r)->mon_capable)
> + return true;
> + return false;
> +}
Same comments as for resctrl_alloc_capable().
> +
> /**
> * struct resctrl_schema - configuration abilities of a resource presented to
> * user-space
Rest looks good to me.
Reinette