mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-16 23:45:31 +08:00
Reduce redundant counter reads with resctrl refactoring
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEV76QKkVc4xCGURexaDWVMHDJkrAFAmRKki4ACgkQaDWVMHDJ krDf7w//eQjKw0dny5YZGOaHUNKMzJWQtzAnDJS0HuedWIar5+iCRiLh3zbxyKU0 8IG/xkDHQ5Dd1V7mOyl1g4WdZ/rFmmepl2VtvYnfMs5x+U2sf6LttzzkXetbP+oj x5uvfa9Vx8Ad8unhgYa9KIIkg/x02ImyupPLw32R2a/cMTRoi+LJEGiiUAWFTCx6 4ZCtryAKHDTgrbuOWTz46cEgil3ZQLBI/uvF3IKd7BegfpbXQq/iyXJhhD/hWfVw lqswuGZN+yVLTkyJ4EHxUXAJI1AuH327KZI1SgSTe8AKFiygx0ZOrkmeI6cXbKJO os22OdT+cwAI8OkblH+9rMAd4dmAnLw9o/rGylC9rzwyXmmRII5FJ6LrbWFvsHmh QrUTcRzBtHmwLfqUf60b4bXDmI2MMrN5PAxmvRsHbzSfzMHVJDPXG0IoGBhUPrjS QmZuCNjsaVIOOxaSm+EtfFMeRxmfTEc6e3YxEeykfjGqPph9o0YK6H3o/4MgupJe uik0scEqBzq2MXkOYv5dysiTb57QAR/Y+CWvZHJ1YcwFvjAQahqFSwQ+gItoHTDL Rec9Tq9cm0AG1mZL1fVWFPK+ECiFti3YvZoIZEtAyg6hOMoZsZvu+VWcHFRdgIGk 5riWJE8MiVyzQGcvWFBFbaeYLm1+obGhJHMpMW476K3jr75y+RU= =xO/z -----END PGP SIGNATURE----- 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()
This commit is contained in:
commit
4980c176a7
@ -383,41 +383,36 @@ void free_rmid(u32 rmid)
|
||||
list_add_tail(&entry->list, &rmid_free_lru);
|
||||
}
|
||||
|
||||
static struct mbm_state *get_mbm_state(struct rdt_domain *d, u32 rmid,
|
||||
enum resctrl_event_id evtid)
|
||||
{
|
||||
switch (evtid) {
|
||||
case QOS_L3_MBM_TOTAL_EVENT_ID:
|
||||
return &d->mbm_total[rmid];
|
||||
case QOS_L3_MBM_LOCAL_EVENT_ID:
|
||||
return &d->mbm_local[rmid];
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static int __mon_event_count(u32 rmid, struct rmid_read *rr)
|
||||
{
|
||||
struct mbm_state *m;
|
||||
u64 tval = 0;
|
||||
|
||||
if (rr->first)
|
||||
if (rr->first) {
|
||||
resctrl_arch_reset_rmid(rr->r, rr->d, rmid, rr->evtid);
|
||||
m = get_mbm_state(rr->d, rmid, rr->evtid);
|
||||
if (m)
|
||||
memset(m, 0, sizeof(struct mbm_state));
|
||||
return 0;
|
||||
}
|
||||
|
||||
rr->err = resctrl_arch_rmid_read(rr->r, rr->d, rmid, rr->evtid, &tval);
|
||||
if (rr->err)
|
||||
return rr->err;
|
||||
|
||||
switch (rr->evtid) {
|
||||
case QOS_L3_OCCUP_EVENT_ID:
|
||||
rr->val += tval;
|
||||
return 0;
|
||||
case QOS_L3_MBM_TOTAL_EVENT_ID:
|
||||
m = &rr->d->mbm_total[rmid];
|
||||
break;
|
||||
case QOS_L3_MBM_LOCAL_EVENT_ID:
|
||||
m = &rr->d->mbm_local[rmid];
|
||||
break;
|
||||
default:
|
||||
/*
|
||||
* Code would never reach here because an invalid
|
||||
* event id would fail in resctrl_arch_rmid_read().
|
||||
*/
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (rr->first) {
|
||||
memset(m, 0, sizeof(struct mbm_state));
|
||||
return 0;
|
||||
}
|
||||
|
||||
rr->val += tval;
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user