函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\trace\ring_buffer.c Create Date:2022-07-27 12:58:53
Last Modify:2020-03-17 19:30:04 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:__rb_allocate_pages

函数原型:static int __rb_allocate_pages(long nr_pages, struct list_head *pages, int cpu)

返回类型:int

参数:

类型参数名称
longnr_pages
struct list_head *pages
intcpu
1192  bool user_thread = mm != NULL
1203  i等于si_mem_available()
1204  如果i小于nr_pages则返回:负ENOMEM
1212  mflags等于GFP_KERNEL按位或__GFP_RETRY_MAYFAIL
1223  如果user_threadset_current_oom_origin()
1225 i小于nr_pages循环
1228  bpage等于根据内存节点分配内存
1230  如果非bpage则转到:free_pages
1233  添加链表项
1235  page等于Allocate pages, preferring the node given as nid. When nid == NUMA_NO_NODE,* prefer the current CPU's closest node. Otherwise node must be valid and* online.
1236  如果非page则转到:free_pages
1238  Actual data page 等于page_address(page)
1239  rb_init_page(Actual data page )
1241  如果user_threadfatal_signal_pending(当前进程)则转到:free_pages
1244  如果user_threadclear_current_oom_origin()
1247  返回:0
1249  free_pages :
1251  删除链表项并重新初始化
1252  Also stolen from mm/slob.c. Thanks to Mathieu Desnoyers for pointing* this issue out.
1254  如果user_threadclear_current_oom_origin()
1257  返回:负ENOMEM
调用者
名称描述
rb_allocate_pages
ring_buffer_resizeg_buffer_resize - resize the ring buffer*@buffer: the buffer to resize.*@size: the new size.*@cpu_id: the cpu buffer to resize* Minimum size is 2 * BUF_PAGE_SIZE.* Returns 0 on success and < 0 on failure.