[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4cf425c3-f952-435f-993e-a7750de23a7d@intel.com>
Date: Mon, 3 Nov 2025 14:13:32 -0800
From: Reinette Chatre <reinette.chatre@...el.com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>, Tony Luck
<tony.luck@...el.com>, Dave Martin <Dave.Martin@....com>, James Morse
<james.morse@....com>, Babu Moger <babu.moger@....com>
CC: <linux-kernel@...r.kernel.org>, <kernel-janitors@...r.kernel.org>
Subject: Re: [PATCH] fs/resctrl: Slightly optimize cbm_validate()
Hi Christophe,
On 10/26/25 12:39 AM, Christophe JAILLET wrote:
> 'first_bit' is known to be 1, so it can be skipped when searching for the
> next 0 bit. Doing so mimics bitmap_next_set_region() and can save a few
> cycles.
This is not part of a flow where cycles matter and may thus
not be considered unless it forms part of a larger series. We could
work more on getting this ready for inclusion but please be aware that it
may not be considered. This is up to the x86 maintainers so please also
include them in your next submission (x86@...nel.org).
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> ---
...
> ---
> fs/resctrl/ctrlmondata.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c
> index 0d0ef54fc4de..1ff479a2dbbc 100644
> --- a/fs/resctrl/ctrlmondata.c
> +++ b/fs/resctrl/ctrlmondata.c
> @@ -130,7 +130,7 @@ static bool cbm_validate(char *buf, u32 *data, struct rdt_resource *r)
> }
>
> first_bit = find_first_bit(&val, cbm_len);
> - zero_bit = find_next_zero_bit(&val, cbm_len, first_bit);
> + zero_bit = find_next_zero_bit(&val, cbm_len, first_bit + 1);
>
It looks like cbm_ensure_valid() has the same pattern so a similar change there would
help to make the code consistent.
sidenote: Not related to this patch but looks like cbm_ensure_valid() is missing taking
arch support for sparse masks into account.
> /* Are non-contiguous bitmasks allowed? */
> if (!r->cache.arch_has_sparse_bitmasks &&
Reinette
Powered by blists - more mailing lists