Re: [PATCH v1 4/9] x86/resctrl: Flush MBM event counts on soft RMID change

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Peter,

On 4/21/2023 7:17 AM, Peter Newman wrote:
> To implement soft RMIDs, context switch must detect when the current
> soft RMID is changing and if so, flush the CPU's MBM event counts to the
> outgoing soft RMID.
> 
> To avoid impacting context switch performance in the non-soft RMID case,
> protect the new logic with a static branch.
> 
> Co-developed-by: Stephane Eranian <eranian@xxxxxxxxxx>
> Signed-off-by: Stephane Eranian <eranian@xxxxxxxxxx>
> Signed-off-by: Peter Newman <peternewman@xxxxxxxxxx>
> ---
>  arch/x86/include/asm/resctrl.h         | 27 +++++++++++++++++++++++++-
>  arch/x86/kernel/cpu/resctrl/rdtgroup.c |  1 +
>  2 files changed, 27 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/include/asm/resctrl.h b/arch/x86/include/asm/resctrl.h
> index e7acf118d770..50d05e883dbb 100644
> --- a/arch/x86/include/asm/resctrl.h
> +++ b/arch/x86/include/asm/resctrl.h
> @@ -36,6 +36,9 @@ DECLARE_PER_CPU(struct resctrl_pqr_state, pqr_state);
>  DECLARE_STATIC_KEY_FALSE(rdt_enable_key);
>  DECLARE_STATIC_KEY_FALSE(rdt_alloc_enable_key);
>  DECLARE_STATIC_KEY_FALSE(rdt_mon_enable_key);
> +DECLARE_STATIC_KEY_FALSE(rdt_soft_rmid_enable_key);
> +
> +void resctrl_mbm_flush_cpu(void);
>  
>  /*
>   * __resctrl_sched_in() - Writes the task's CLOSid/RMID to IA32_PQR_MSR
> @@ -75,9 +78,31 @@ static inline void __resctrl_sched_in(struct task_struct *tsk)
>  	}
>  
>  	if (closid != state->cur_closid || rmid != state->cur_rmid) {
> +		if (static_branch_likely(&rdt_soft_rmid_enable_key)) {

Could you please elaborate on the choice of static_branch_likely() (as opposed
to static_branch_unlikely())?

Reinette



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux