Skip to content

Commit ef9a08c

Browse files
committed
sched-analyzer.bpf: Collect correct effective uclamp values
We must check that the effective value is active otherwise it contains wrong data. On the other hand we might be collecting the data at the wrong location if active is false sometimes/all the times. Signed-off-by: Qais Yousef <qyousef@layalina.io>
1 parent 2d66349 commit ef9a08c

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

sched-analyzer.bpf.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,16 @@ int BPF_PROG(handle_pelt_se, struct sched_entity *se)
150150
bpf_printk("[%s] Req: uclamp_min = %lu uclamp_max = %lu",
151151
comm, uclamp_min, uclamp_max);
152152

153-
if (bpf_core_field_exists(p->uclamp[UCLAMP_MIN].value))
154-
uclamp_min = BPF_CORE_READ_BITFIELD_PROBED(p, uclamp[UCLAMP_MIN].value);
155-
if (bpf_core_field_exists(p->uclamp[UCLAMP_MAX].value))
156-
uclamp_max = BPF_CORE_READ_BITFIELD_PROBED(p, uclamp[UCLAMP_MAX].value);
153+
if (bpf_core_field_exists(p->uclamp[UCLAMP_MIN].value)) {
154+
bool active = BPF_CORE_READ_BITFIELD_PROBED(p, uclamp[UCLAMP_MIN].active);
155+
if (active)
156+
uclamp_min = BPF_CORE_READ_BITFIELD_PROBED(p, uclamp[UCLAMP_MIN].value);
157+
}
158+
if (bpf_core_field_exists(p->uclamp[UCLAMP_MAX].value)) {
159+
bool active = BPF_CORE_READ_BITFIELD_PROBED(p, uclamp[UCLAMP_MAX].active);
160+
if (active)
161+
uclamp_max = BPF_CORE_READ_BITFIELD_PROBED(p, uclamp[UCLAMP_MAX].value);
162+
}
157163

158164
bpf_printk("[%s] Eff: uclamp_min = %lu uclamp_max = %lu",
159165
comm, uclamp_min, uclamp_max);

0 commit comments

Comments
 (0)