ring_buffer_alloc_read_page(9)
π« ring_buffer_alloc_read_page β the Kernel API Manual glow-up π«
okay so bestie, you know how ring_buffer stuff can feel like a whole vibe and a half? this one is the lil helper that gets your read pages ready before you need them, so you're not scrambling at the worst possible moment. it's giving "prep queen" energy. π
β¨ NAME β¨
ring_buffer_alloc_read_page β literally just allocate a page so you can read from the buffer π
πΈ SYNOPSIS πΈ
int ring_buffer_alloc_read_page (struct trace_buffer *buffer , int cpu ,
struct buffer_data_read_page **rpage );
π¦ ARGUMENTS π¦
- buffer β the buffer you're allocating for, like, obviously.
- cpu β the cpu buffer you're allocating for.
- rpage β a pointer where you can pass in an already allocated page (it can be
NULL, no pressure) and it returns the allocated page back to you. π«Ά
π DESCRIPTION π
okay so this function is the bestie of ring_buffer_read_page. they literally only function together. when you're reading a full page out of the ring buffer, these two team up to speed the whole process way up. no cap. π₯
the move is: your calling function should allocate a few pages first with this function. yes, ahead of time. main character planning energy. then, when it actually needs to get pages from the ring buffer, it passes the result of this function into ring_buffer_read_page, which will swap the page that was allocated with the read page of the buffer. boom. iconic. π
and here's the detail that matters: if rpage is provided and it has a different order than the current subbuffer order, its payload will be freed and re-allocated. if it already matches the order, it is simply returned. like, it just hands it right back. so chill. π§
β RETURN β
0 on success, < 0 on error. that's it, that's the whole mood. π
π SEE ALSO π
so many siblings, honestly a whole family reunion. every single one of these, in this exact order, bestie:
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)ring_buffer_lock_reserve(9)ring_buffer_discard_commit(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_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)
and yeah, the kernel file you want is ./kernel/trace/ring_buffer.c β that's where all the lore lives. πβ¨
π sign-off π
this whole thing lives in ./kernel/trace, it's the Kernel API Manual, and it's dated October 2026. go read a page for me bestie, ily, bye! ππ¦πΈ
π¦ 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