RE: [PATCH v6 09/24] x86/resctrl: Use set_bit()/clear_bit() instead of open coding

David Laight
2023-09-17T21:01:54Z

From: James Morse
> Sent: 14 September 2023 18:21
>
> The resctrl CLOSID allocator uses a single 32bit word to track which
> CLOSID are free. The setting and clearing of bits is open coded.
>
> A subsequent patch adds resctrl_closid_is_free(), which adds more open
> coded bitmaps operations. These will eventually need changing to use
> the bitops helpers so that a CLOSID bitmap of the correct size can be
> allocated dynamically.
>
> Convert the existing open coded bit manipulations of closid_free_map
> to use set_bit() and friends.
>
> int closids_supported(void)
> @@ -126,7 +126,7 @@ static void closid_init(void)
> closid_free_map = BIT_MASK(rdt_min_closid) - 1;
>
> /* CLOSID 0 is always reserved for the default group */
> - closid_free_map &= ~1;
> + clear_bit(0, &closid_free_map);

Don't the clear_bit() etc functions use locked accesses?
These are always measurably more expensive than the C operators.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)