Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\events\ring_buffer.c Create Date:2022-07-28 13:42:45
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:rb_alloc

Proto:struct ring_buffer *rb_alloc(int nr_pages, long watermark, int cpu, int flags)

Type:struct ring_buffer

Parameter:

TypeParameterName
intnr_pages
longwatermark
intcpu
intflags
807  size = sizeof(structring_buffer)
808  size += nr_pages * size of *
810  If rder_base_2 - calculate the (rounded up) base 2 order of the argument*@n: parameter* The first few values calculated by this routine:* ob2(0) = 0* ob2(1) = 0* ob2(2) = 1* ob2(3) = 2* ob2(4) = 2* ob2(5) = 3* ... and so on.(size) >= PAGE_SHIFT determines the page size + Free memory management - zoned buddy allocator. Then Go to fail
813  rb = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
814  If Not rb Then Go to fail
817  user_page = perf_mmap_alloc_page(cpu)
818  If Not user_page Then Go to fail_user_page
821  When i < nr_pages cycle
822  data_pages[i] = perf_mmap_alloc_page(cpu)
823  If Not data_pages[i] Then Go to fail_data_pages
827  nr of data pages = nr_pages
829  ring_buffer_init(rb, watermark, flags)
831  Return rb
833  fail_data_pages :
834  When i >= 0 cycle perf_mmap_free_page(data_pages[i])
837  perf_mmap_free_page(user_page)
839  fail_user_page :
840  kfree(rb)
842  fail :
843  Return NULL