Skip to content

Commit 9bd3c36

Browse files
authored
perf: fix panic when CPU is offline
Commit 75bce38 ("perf: opportunistically check all rings for data") introduced a panic on systems where not all CPUs are online. Fix this by skipping nil rings. Signed-off-by: zhuhuijun <[email protected]>
1 parent 9d0e701 commit 9bd3c36

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

perf/reader.go

+5
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,11 @@ func (pr *Reader) ReadInto(rec *Record) error {
386386
// Waking up userspace is expensive, make the most of it by checking
387387
// all rings.
388388
for _, ring := range pr.rings {
389+
// Skip rings that are not currently enabled.
390+
if ring == nil {
391+
continue
392+
}
393+
389394
ring.loadHead()
390395
pr.epollRings = append(pr.epollRings, ring)
391396
}

0 commit comments

Comments
 (0)