Skip to content

Commit

Permalink
perf: fix panic when CPU is offline
Browse files Browse the repository at this point in the history
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 <zhuhuijunzhj@gmail.com>
  • Loading branch information
Ghostbaby authored Jul 9, 2024
1 parent 9d0e701 commit 9bd3c36
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions perf/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,11 @@ func (pr *Reader) ReadInto(rec *Record) error {
// Waking up userspace is expensive, make the most of it by checking
// all rings.
for _, ring := range pr.rings {
// Skip rings that are not currently enabled.
if ring == nil {
continue
}

ring.loadHead()
pr.epollRings = append(pr.epollRings, ring)
}
Expand Down

0 comments on commit 9bd3c36

Please sign in to comment.