Skip to content

perf: do not add offline CPUs #1510

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions perf/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,6 @@ func NewReaderWithOptions(array *ebpf.Map, perCPUBuffer int, opts ReaderOptions)
event, ring, err := newPerfEventRing(i, perCPUBuffer, opts)
if errors.Is(err, unix.ENODEV) {
// The requested CPU is currently offline, skip it.
rings = append(rings, nil)
eventFds = append(eventFds, nil)
continue
}

Expand Down Expand Up @@ -288,14 +286,10 @@ func (pr *Reader) Close() error {
defer pr.pauseMu.Unlock()

for _, ring := range pr.rings {
if ring != nil {
ring.Close()
}
ring.Close()
}
for _, event := range pr.eventFds {
if event != nil {
event.Close()
}
event.Close()
}
pr.rings = nil
pr.eventFds = nil
Expand Down Expand Up @@ -386,11 +380,6 @@ 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