Re: [PATCH v8 3/7] x86/resctrl: Refactor mbm_update()
From: Tony Luck
Date: Fri Nov 01 2024 - 18:57:30 EST
On Fri, Nov 01, 2024 at 03:08:27PM -0700, Fenghua Yu wrote:
> > - /*
> > - * Call the MBA software controller only for the
> > - * control groups and when user has enabled
> > - * the software controller explicitly.
> > - */
>
> Same comment was added in patch 2 but is removed in the helper. Maybe it's
> better to add back the comment in the helper.
>
> > - if (is_mba_sc(NULL))
> > - mbm_bw_count(closid, rmid, &rr);
In patch 2 I cut & pasted the comment along with the code from
the if (is_mbm_local()) {...} clause into the if (is_mbm_total()) { ... }
clause. Maybe to make it more obvious that the code was duplicated.
But I had doubts about the usefulness/accuracy when making the
helper function.
Breaking the comment into pieces:
"Call the MBA software controller"
This code isn't calling the "controller". To me that's the
update_mba_bw() function that adjusts the MBA values. The
call to mbm_bw_count() is simply computing the bandwidth.
"only for the control groups"
while this is true, the test in the code here "if (is_mba_sc(NULL))"
isn't making any checks about control groups.
"and when user has enabled the software controller"
Accurate.
"explicitly"
Redundant (or confusing, there is no "implicit" way to enable
the s/w controller).
If a comment is needed (and I'm not convinced that it is)
maybe something like:
/*
* If the software controller controller is enabled, compute the
* bandwidth for this event id.
*/
-Tony