Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:__rb_allocate_pages

Proto:static int __rb_allocate_pages(long nr_pages, struct list_head *pages, int cpu)

Type:int

Parameter:

TypeParameterName
longnr_pages
struct list_head *pages
intcpu
1192  bool user_thread = mm != NULL
1203  i = si_mem_available()
1204  If i < nr_pages Then Return -ENOMEM
1212  mflags = GFP_KERNEL | __GFP_RETRY_MAYFAIL
1223  If user_thread Then set_current_oom_origin()
1225  When i < nr_pages cycle
1228  bpage = kzalloc_node - allocate zeroed memory from a particular memory node.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).*@node: memory node from which to allocate
1230  If Not bpage Then Go to free_pages
1233  list_add - add a new entry*@new: new entry to be added*@head: list head to add it after* Insert a new entry after the specified head.* This is good for implementing stacks.
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  If Not page Then Go to free_pages
1238  Actual data page = page_address(page)
1239  rb_init_page(Actual data page )
1241  If user_thread && fatal_signal_pending(current process) Then Go to free_pages
1244  If user_thread Then clear_current_oom_origin()
1247  Return 0
1249  free_pages :
1251  list_del_init - deletes entry from list and reinitialize it.*@entry: the element to delete from the list.
1252  Also stolen from mm/slob.c. Thanks to Mathieu Desnoyers for pointing* this issue out.
1254  If user_thread Then clear_current_oom_origin()
1257  Return -ENOMEM
Caller
NameDescribe
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.