Skip to content

Commit 5a88a6e

Browse files
rchatrebp3tk0v
authored andcommitted
fs/resctrl: Consider sparse masks when initializing new group's allocation
A new resource group is intended to be created with sane defaults. For a cache resource this means all cache portions the new group could possibly allocate into. This includes unused cache portions and shareable cache portions used by other groups and hardware. New resource group creation does not take sparse masks into account. After determining the bitmask reflecting the new group's possible allocations the bitmask is forced to be contiguous even if the system supports sparse masks. For example, a new group could by default allocate into a large portion of cache represented by 0xff0f, but it is instead created with a mask of 0xf. Do not force a contiguous allocation range if the system supports sparse masks. Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Link: https://patch.msgid.link/abbbb008bc09d982d715e79d3b885c10f92c64e0.1763426240.git.reinette.chatre@intel.com
1 parent a0a0999 commit 5a88a6e

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

fs/resctrl/rdtgroup.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3383,11 +3383,12 @@ static u32 cbm_ensure_valid(u32 _val, struct rdt_resource *r)
33833383
{
33843384
unsigned int cbm_len = r->cache.cbm_len;
33853385
unsigned long first_bit, zero_bit;
3386-
unsigned long val = _val;
3386+
unsigned long val;
33873387

3388-
if (!val)
3389-
return 0;
3388+
if (!_val || r->cache.arch_has_sparse_bitmasks)
3389+
return _val;
33903390

3391+
val = _val;
33913392
first_bit = find_first_bit(&val, cbm_len);
33923393
zero_bit = find_next_zero_bit(&val, cbm_len, first_bit);
33933394

0 commit comments

Comments
 (0)