ring_buffer_discard_commit(9)
π« 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 callring_buffer_unlock_commiton the event. like actually do not. that's the whole rule.ring_buffer_discard_commitalready handled the commit business, so callingring_buffer_unlock_commiton 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 π
ring_buffer_event_length(9),ring_buffer_event_data(9)rb_page_capacity(9),rb_subbuf_capacity(9),rb_subbuf_max_data_size(9),rb_subbuf_start(9)ring_buffer_event_time_stamp(9),ring_buffer_nr_dirty_pages(9)ring_buffer_wake_waiters(9),ring_buffer_wait(9),ring_buffer_poll_wait(9)rb_check_pages(9),rb_validate_buffer(9)__ring_buffer_alloc(9),__ring_buffer_alloc_range(9),__ring_buffer_alloc_remote(9),ring_buffer_free(9),ring_buffer_resize(9)rb_update_event(9),ring_buffer_nest_start(9),ring_buffer_nest_end(9)ring_buffer_unlock_commit(9)(the one you're NOT calling, remember π ),ring_buffer_lock_reserve(9),ring_buffer_write(9)ring_buffer_record_disable(9),ring_buffer_record_enable(9),ring_buffer_record_off(9),ring_buffer_record_on(9),ring_buffer_record_is_on(9),ring_buffer_record_is_set_on(9),ring_buffer_record_is_on_cpu(9),ring_buffer_record_disable_cpu(9),ring_buffer_record_enable_cpu(9)ring_buffer_oldest_event_ts(9),ring_buffer_bytes_cpu(9),ring_buffer_entries_cpu(9),ring_buffer_overrun_cpu(9),ring_buffer_commit_overrun_cpu(9),ring_buffer_dropped_events_cpu(9),ring_buffer_read_events_cpu(9),ring_buffer_entries(9),ring_buffer_overruns(9)ring_buffer_iter_reset(9),ring_buffer_iter_empty(9),ring_buffer_peek(9),ring_buffer_iter_peek(9),ring_buffer_consume(9),ring_buffer_read_start(9),ring_buffer_read_finish(9),ring_buffer_iter_advance(9)ring_buffer_size(9),ring_buffer_max_event_size(9)ring_buffer_reset_cpu(9),ring_buffer_reset_online_cpus(9),ring_buffer_reset(9)ring_buffer_empty(9),ring_buffer_empty_cpu(9),ring_buffer_swap_cpu(9)ring_buffer_alloc_read_page(9),ring_buffer_free_read_page(9),ring_buffer_read_page(9),ring_buffer_read_page_data(9),ring_buffer_read_page_size(9)ring_buffer_subbuf_size_get(9),ring_buffer_subbuf_order_get(9),ring_buffer_subbuf_order_set(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms