File tree Expand file tree Collapse file tree 2 files changed +11
-20
lines changed
arch/x86/kernel/cpu/resctrl Expand file tree Collapse file tree 2 files changed +11
-20
lines changed Original file line number Diff line number Diff line change @@ -292,9 +292,8 @@ static void pseudo_lock_region_clear(struct pseudo_lock_region *plr)
292
292
*/
293
293
static int pseudo_lock_region_init (struct pseudo_lock_region * plr )
294
294
{
295
- struct cpu_cacheinfo * ci ;
295
+ struct cacheinfo * ci ;
296
296
int ret ;
297
- int i ;
298
297
299
298
/* Pick the first cpu we find that is associated with the cache. */
300
299
plr -> cpu = cpumask_first (& plr -> d -> cpu_mask );
@@ -306,15 +305,11 @@ static int pseudo_lock_region_init(struct pseudo_lock_region *plr)
306
305
goto out_region ;
307
306
}
308
307
309
- ci = get_cpu_cacheinfo (plr -> cpu );
310
-
311
- plr -> size = rdtgroup_cbm_to_size (plr -> s -> res , plr -> d , plr -> cbm );
312
-
313
- for (i = 0 ; i < ci -> num_leaves ; i ++ ) {
314
- if (ci -> info_list [i ].level == plr -> s -> res -> cache_level ) {
315
- plr -> line_size = ci -> info_list [i ].coherency_line_size ;
316
- return 0 ;
317
- }
308
+ ci = get_cpu_cacheinfo_level (plr -> cpu , plr -> s -> res -> cache_level );
309
+ if (ci ) {
310
+ plr -> line_size = ci -> coherency_line_size ;
311
+ plr -> size = rdtgroup_cbm_to_size (plr -> s -> res , plr -> d , plr -> cbm );
312
+ return 0 ;
318
313
}
319
314
320
315
ret = -1 ;
Original file line number Diff line number Diff line change @@ -1450,18 +1450,14 @@ static ssize_t rdtgroup_mode_write(struct kernfs_open_file *of,
1450
1450
unsigned int rdtgroup_cbm_to_size (struct rdt_resource * r ,
1451
1451
struct rdt_domain * d , unsigned long cbm )
1452
1452
{
1453
- struct cpu_cacheinfo * ci ;
1454
1453
unsigned int size = 0 ;
1455
- int num_b , i ;
1454
+ struct cacheinfo * ci ;
1455
+ int num_b ;
1456
1456
1457
1457
num_b = bitmap_weight (& cbm , r -> cache .cbm_len );
1458
- ci = get_cpu_cacheinfo (cpumask_any (& d -> cpu_mask ));
1459
- for (i = 0 ; i < ci -> num_leaves ; i ++ ) {
1460
- if (ci -> info_list [i ].level == r -> cache_level ) {
1461
- size = ci -> info_list [i ].size / r -> cache .cbm_len * num_b ;
1462
- break ;
1463
- }
1464
- }
1458
+ ci = get_cpu_cacheinfo_level (cpumask_any (& d -> cpu_mask ), r -> cache_level );
1459
+ if (ci )
1460
+ size = ci -> size / r -> cache .cbm_len * num_b ;
1465
1461
1466
1462
return size ;
1467
1463
}
You can’t perform that action at this time.
0 commit comments