ring_buffer_discard_commit(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’« ring_buffer_discard_commit β€” the "nvm, forget that event" era πŸ’«

okay so this is a page from the Kernel API Manual, bestie β€” section 9, kernel dev vibes only. sit down, hydrate, and let's get into it 🫢


✨ NAME ✨

ring_buffer_discard_commit β€” discard an event that has not been committed. literally the "undo button but make it kernel" situation πŸ˜­πŸ’…


🌸 SYNOPSIS 🌸

void ring_buffer_discard_commit (struct trace_buffer *buffer , struct ring_buffer_event *event );

that's the whole signature, no cap. returns nothing (void), takes two things, does the thing πŸ’–


πŸŽ€ ARGUMENTS πŸŽ€

  • buffer β€” the ring buffer. the venue, the stage, the whole main character location of this operation ✨
  • event β€” non committed event to discard. emphasis on non committed, bestie, this is not a drill πŸ”₯

πŸ¦‹ DESCRIPTION πŸ¦‹

Sometimes an event that is in the ring buffer needs to be ignored πŸ‘€ like, it's there, it exists, but we're choosing to pretend we don't see it (respectfully). This function lets the user discard an event in the ring buffer, and then that event will not be read later. gone. ghosted. blocked. periodt πŸ’€

This function only works if it is called before the item has been committed. read that again. before. committed. no take-backs after 😀 It will try to free the event from the ring buffer if another event has not been added behind it.

If another event has been added behind it, it will set the event up as discarded, and perform the commit. so it's still handled, just flagged as "yeah no" πŸ™ˆβœ¨

⚠️ okay this is the important one, don't skip it: if this function is called, do not call ring_buffer_unlock_commit on the event. like actually do not. that's the whole rule. ring_buffer_discard_commit already handled the commit business, so calling ring_buffer_unlock_commit on top of it is not the vibe πŸ’€ not me warning you twice.

πŸ’œ SEE ALSO πŸ’œ

the whole friend group, fr fr β€” starting with the kernel file itself: ./kernel/trace/ring_buffer.c 🌈


okay that's the whole page, mwah πŸ’‹ one last cute sign-off: this little icon lives in ./kernel/trace, dated October 2026, and it's filed under ring_buffer_discard_commit(9). go forth and discard responsibly, bestie πŸ§šβ€β™€οΈβ­πŸ’–

πŸ“¦ where this page comes from