函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\events\ring_buffer.c Create Date:2022-07-27 15:03:35
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:rb_alloc

函数原型:struct ring_buffer *rb_alloc(int nr_pages, long watermark, int cpu, int flags)

返回类型:struct ring_buffer

参数:

类型参数名称
intnr_pages
longwatermark
intcpu
intflags
807  size等于sizeof(structring_buffer)
808  size加等于nr_pages乘*的长度
810  如果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. 则转到:fail
813  rb等于分配内存并置零
814  如果非rb则转到:fail
817  user_page等于perf_mmap_alloc_page(cpu)
818  如果非user_page则转到:fail_user_page
821 i小于nr_pages循环
822  data_pages[i]等于perf_mmap_alloc_page(cpu)
823  如果非data_pages[i]则转到:fail_data_pages
827  nr of data pages 等于nr_pages
829  ring_buffer_init(rb, watermark, flags)
831  返回:rb
833  fail_data_pages :
834 i大于等于0循环perf_mmap_free_page(data_pages[i])
837  perf_mmap_free_page(user_page)
839  fail_user_page :
840  kfree(rb)
842  fail :
843  返回:NULL
调用者
名称描述
perf_mmap