Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:g_buffer_read_page - extract a page from the ring buffer*@buffer: buffer to extract from*@data_page: the page to use allocated from ring_buffer_alloc_read_page*@len: amount to extract*@cpu: the cpu of the buffer to extract

Proto:int ring_buffer_read_page(struct ring_buffer *buffer, void **data_page, size_t len, int cpu, int full)

Type:int

Parameter:

TypeParameterName
struct ring_buffer *buffer
void **data_page
size_tlen
intcpu
intfull
4703  cpu_buffer = buffers[cpu]
4712  ret = -1
4714  If Not pumask_test_cpu - test for a cpu in a cpumask*@cpu: cpu number (< nr_cpu_ids)*@cpumask: the cpumask pointer* Returns 1 if @cpu is set in @cpumask, else returns 0 Then Go to out
4721  If len <= BUF_PAGE_HDR_SIZE Then Go to out
4724  len -= BUF_PAGE_HDR_SIZE
4726  If Not data_page Then Go to out
4729  bpage = data_page
4730  If Not bpage Then Go to out
4733  raw_spin_lock_irqsave( & serialize readers , flags)
4735  reader = rb_get_reader_page(cpu_buffer)
4736  If Not reader Then Go to out_unlock
4739  event = rb_reader_event(cpu_buffer)
4741  read = dex for next read
4742  commit = rb_page_commit(reader)
4745  missed_events = lost_events
4754  If read || len < commit - read || reader_page == committed pages Then
4756  rpage = Actual data page
4757  rpos = read
4758  pos = 0
4761  If full Then Go to out_unlock
4764  If len > commit - read Then len = commit - read
4768  size = Return total length of time extend and data,* or just the event length for all other events.
4770  If len < size Then Go to out_unlock
4774  save_timestamp = read_stamp
4777  Do
4787  len -= size
4791  pos += size
4793  If rpos >= commit Then Break
4799  When len >= size cycle
4802  local_set( & write committed index , pos)
4803  page time stamp = save_timestamp
4806  read = 0
4807  Else
4809  read += rb_page_entries(reader)
4810  read_bytes += BUF_PAGE_SIZE
4813  rb_init_page(bpage)
4814  bpage = Actual data page
4815  Actual data page = data_page
4816  local_set( & dex for next write , 0)
4817  local_set( & ries on this page , 0)
4818  dex for next read = 0
4819  data_page = bpage
4826  If al end of data Then local_set( & write committed index , al end of data )
4829  ret = read
4831  lost_events = 0
4833  commit = local_read( & write committed index )
4837  If missed_events Then
4841  If BUF_PAGE_SIZE - commit >= size of missed_events Then
4845  commit += size of missed_events
4847  local_add(Flag when events were overwritten , & write committed index )
4853  If commit < BUF_PAGE_SIZE Then memset( & data of buffer page [commit], 0, BUF_PAGE_SIZE - commit)
4856  out_unlock :
4857  raw_spin_unlock_irqrestore( & serialize readers , flags)
4859  out :
4860  Return ret
Caller
NameDescribe
read_page
tracing_buffers_read
tracing_buffers_splice_read