lkml.org 
[lkml]   [2023]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v4 05/24] x86/resctrl: Allow RMID allocation to be scoped by CLOSID
From
Hi James,

On 5/25/2023 11:01 AM, James Morse wrote:

> diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
> index bcc25f5339c0..27e731c7de72 100644
> --- a/arch/x86/kernel/cpu/resctrl/monitor.c
> +++ b/arch/x86/kernel/cpu/resctrl/monitor.c
> @@ -337,24 +337,49 @@ bool has_busy_rmid(struct rdt_resource *r, struct rdt_domain *d)
> return find_first_bit(d->rmid_busy_llc, idx_limit) != idx_limit;
> }
>
> -/*
> - * As of now the RMIDs allocation is global.
> - * However we keep track of which packages the RMIDs
> - * are used to optimize the limbo list management.
> - */
> -int alloc_rmid(void)
> +static struct rmid_entry *resctrl_find_free_rmid(u32 closid)
> {
> - struct rmid_entry *entry;
> -
> - lockdep_assert_held(&rdtgroup_mutex);
> + struct rmid_entry *itr;
> + u32 itr_idx, cmp_idx;
>
> if (list_empty(&rmid_free_lru))
> - return rmid_limbo_count ? -EBUSY : -ENOSPC;
> + return rmid_limbo_count ? ERR_PTR(-EBUSY) : ERR_PTR(-ENOSPC);
> +
> + list_for_each_entry(itr, &rmid_free_lru, list) {
> + /*
> + * get the index of this free RMID, and the index it would need
> + * to be if it were used with this CLOSID.

Please start sentences with a capital letter.

> + * If the CLOSID is irrelevant on this architecture, these will
> + * always be the same meaning the compiler can reduce this loop
> + * to a single list_entry_first() call.
> + */
> + itr_idx = resctrl_arch_rmid_idx_encode(itr->closid, itr->rmid);
> + cmp_idx = resctrl_arch_rmid_idx_encode(closid, itr->rmid);
> +
> + if (itr_idx == cmp_idx)
> + return itr;
> + }
> +
> + return ERR_PTR(-ENOSPC);
> +}
> +

Reinette

\
 
 \ /
  Last update: 2023-06-16 00:06    [W:0.615 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site