Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\trace\ring_buffer.c Create Date:2022-07-28 11:54:36
Last Modify:2020-03-17 19:30:04 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:rb_reserve_next_event

Proto:static __always_inline struct ring_buffer_event *rb_reserve_next_event(struct ring_buffer *buffer, struct ring_buffer_per_cpu *cpu_buffer, unsigned long length)

Type:struct ring_buffer_event

Parameter:

TypeParameterName
struct ring_buffer *buffer
struct ring_buffer_per_cpu *cpu_buffer
unsigned longlength
2877  nr_loops = 0
2880  rb_start_commit(cpu_buffer)
2897  length = rb_calculate_event_length(length)
2898  again :
2899  add_timestamp = 0
2900  delta = 0
2911  If uffer may be either ring_buffer or ring_buffer_per_cpu (cpu_buffer, ++nr_loops > 1000) Then Go to out_fail
2914  ts = rb_time_stamp(buffer)
2915  diff = ts - write_stamp
2918  The "volatile" is due to gcc bugs ()
2920  If ring_buffer_time_stamp_abs(buffer) Then
2921  delta = ts
2922  rb_handle_timestamp(cpu_buffer, & info)
2923  Else If Value is more likely to compile time(ts >= write_stamp) Then
2925  delta = diff
2926  If Value for the false possibility is greater at compile time(We need to fit the time_stamp delta into 27 bits.) Then rb_handle_timestamp(cpu_buffer, & info)
2930  event = __rb_reserve_next(cpu_buffer, & info)
2932  If Value for the false possibility is greater at compile time(PTR_ERR(event) == - EAGAIN) Then
2933  If add_timestamp Then length -= RB_LEN_TIME_EXTEND
2935  Go to again
2938  If Not event Then Go to out_fail
2941  Return event
2943  out_fail :
2944  rb_end_commit(cpu_buffer)
2945  Return NULL
Caller
NameDescribe
ring_buffer_lock_reserveg_buffer_lock_reserve - reserve a part of the buffer*@buffer: the ring buffer to reserve from*@length: the length of the data to reserve (excluding event header)* Returns a reserved event on the ring buffer to copy directly to
ring_buffer_writeg_buffer_write - write data to the buffer without reserving*@buffer: The ring buffer to write to