Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'x86_cache_for_6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 resctrl update from Dave Hansen:
"Reduce redundant counter reads with resctrl refactoring"

* tag 'x86_cache_for_6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/resctrl: Avoid redundant counter read in __mon_event_count()

+19 -24
+19 -24
arch/x86/kernel/cpu/resctrl/monitor.c
··· 383 383 list_add_tail(&entry->list, &rmid_free_lru); 384 384 } 385 385 386 + static struct mbm_state *get_mbm_state(struct rdt_domain *d, u32 rmid, 387 + enum resctrl_event_id evtid) 388 + { 389 + switch (evtid) { 390 + case QOS_L3_MBM_TOTAL_EVENT_ID: 391 + return &d->mbm_total[rmid]; 392 + case QOS_L3_MBM_LOCAL_EVENT_ID: 393 + return &d->mbm_local[rmid]; 394 + default: 395 + return NULL; 396 + } 397 + } 398 + 386 399 static int __mon_event_count(u32 rmid, struct rmid_read *rr) 387 400 { 388 401 struct mbm_state *m; 389 402 u64 tval = 0; 390 403 391 - if (rr->first) 404 + if (rr->first) { 392 405 resctrl_arch_reset_rmid(rr->r, rr->d, rmid, rr->evtid); 406 + m = get_mbm_state(rr->d, rmid, rr->evtid); 407 + if (m) 408 + memset(m, 0, sizeof(struct mbm_state)); 409 + return 0; 410 + } 393 411 394 412 rr->err = resctrl_arch_rmid_read(rr->r, rr->d, rmid, rr->evtid, &tval); 395 413 if (rr->err) 396 414 return rr->err; 397 - 398 - switch (rr->evtid) { 399 - case QOS_L3_OCCUP_EVENT_ID: 400 - rr->val += tval; 401 - return 0; 402 - case QOS_L3_MBM_TOTAL_EVENT_ID: 403 - m = &rr->d->mbm_total[rmid]; 404 - break; 405 - case QOS_L3_MBM_LOCAL_EVENT_ID: 406 - m = &rr->d->mbm_local[rmid]; 407 - break; 408 - default: 409 - /* 410 - * Code would never reach here because an invalid 411 - * event id would fail in resctrl_arch_rmid_read(). 412 - */ 413 - return -EINVAL; 414 - } 415 - 416 - if (rr->first) { 417 - memset(m, 0, sizeof(struct mbm_state)); 418 - return 0; 419 - } 420 415 421 416 rr->val += tval; 422 417