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:38
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:rb_alloc_aux

Proto:int rb_alloc_aux(struct ring_buffer *rb, struct perf_event *event, unsigned long pgoff, int nr_pages, long watermark, int flags)

Type:int

Parameter:

TypeParameterName
struct ring_buffer *rb
struct perf_event *event
unsigned longpgoff
intnr_pages
longwatermark
intflags
668  overwrite = Not (flags & Buffer handling )
669  node = If cpu == -1 Then -1 Else cpu_to_node(cpu)
670  ret = -ENOMEM
672  If Not has_aux(event) Then Return -EOPNOTSUPP
679  max_order = log2 - log base 2 of 32-bit or a 64-bit unsigned value*@n: parameter* constant-capable log of base 2 calculation* - this can be used to initialise global variables from constant data, hence* the massive ternary operator construction* selects the (nr_pages)
685  If Not overwrite Then
686  If Not max_order Then Return -EINVAL
689  max_order--
692  aux_pages = kcalloc_node(nr_pages, size of * , GFP_KERNEL, node)
694  If Not aux_pages Then Return -ENOMEM
697  free_aux = free_aux
698  When aux_nr_pages < nr_pages cycle
702  order = min - return minimum of two values of the same or compatible types*@x: first value*@y: second value(max_order, log2 - log base 2 of 32-bit or a 64-bit unsigned value*@n: parameter* constant-capable log of base 2 calculation* - this can be used to initialise global variables from constant data, hence* the massive ternary operator construction* selects the (nr_pages - aux_nr_pages))
703  page = rb_alloc_aux_page(node, order)
704  If Not page Then Go to out
707  When last > aux_nr_pages cycle aux_pages[aux_nr_pages] = page_address(page++)
718  If capabilities & PERF_PMU_CAP_AUX_NO_SG && overwrite Then
720  page = virt_to_page(kaddr) returns a valid pointer if and only if* virt_addr_valid(kaddr) returns true.(aux_pages[0])
722  If page_private(page) != max_order Then Go to out
726  aux_priv = setup_aux(event, aux_pages, nr_pages, overwrite)
728  If Not aux_priv Then Go to out
731  ret = 0
739  _set - set a refcount's value*@r: the refcount*@n: value to which the refcount will be set
741  aux_overwrite = overwrite
742  aux_watermark = watermark
744  If Not aux_watermark && Not aux_overwrite Then aux_watermark = nr_pages << PAGE_SHIFT determines the page size - 1
747  out :
748  If Not ret Then aux_pgoff = pgoff
750  Else __rb_free_aux(rb)
753  Return ret