Skip to content

ebpf: delete entry from map for off cpu sampling#599

Merged
fabled merged 1 commit intomainfrom
issue-593
Jul 11, 2025
Merged

ebpf: delete entry from map for off cpu sampling#599
fabled merged 1 commit intomainfrom
issue-593

Conversation

@florianl
Copy link
Copy Markdown
Member

Make sure the stack is not unwound multiple times for the same pid_tgid with the same start time.

Fixes #593

@florianl florianl requested review from a team as code owners July 11, 2025 08:27

// Remove entry from the map so the stack for the same pid_tgid does not get unwound and
// reported accidentally without the start timestamp updated in tracepoint/sched/sched_switch.
bpf_map_delete_elem(&sched_times, &pid_tgid);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: We can not use bpf_map_lookup_and_delete_elem (introduced with Kernel 4.20) here, as this is a user space helper, that is not available as eBPF helper.

Make sure the stack is not unwound multiple times for the same pid_tgid with the same
start time.

Fixes #593

Signed-off-by: Florian Lehner <florian.lehner@elastic.co>
@fabled fabled merged commit 7a0ae33 into main Jul 11, 2025
27 checks passed
@fabled fabled deleted the issue-593 branch July 11, 2025 11:26
gnurizen pushed a commit to parca-dev/opentelemetry-ebpf-profiler that referenced this pull request Aug 12, 2025
Signed-off-by: Florian Lehner <florian.lehner@elastic.co>
gnurizen pushed a commit to parca-dev/opentelemetry-ebpf-profiler that referenced this pull request Aug 13, 2025
Signed-off-by: Florian Lehner <florian.lehner@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: off-cpu schedule time bug

3 participants