Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:We only allocate new buffers, never free them if the CPU goes down.* If we were to free the buffer, then the user would lose any trace that was in* the buffer.

Proto:int trace_rb_cpu_prepare(unsigned int cpu, struct hlist_node *node)

Type:int

Parameter:

TypeParameterName
unsigned intcpu
struct hlist_node *node
4876  buffer = container_of - cast a member of a structure out to the containing structure*@ptr: the pointer to the member.*@type: the type of the container struct this is embedded in.*@member: the name of the member within the struct.(node, structring_buffer, node)
4877  If pumask_test_cpu - test for a cpu in a cpumask*@cpu: cpu number (< nr_cpu_ids)*@cpumask: the cpumask pointer* Returns 1 if @cpu is set in @cpumask, else returns 0 Then Return 0
4880  nr_pages = 0
4881  nr_pages_same = 1
4883  for_each_buffer_cpu(buffer, cpu_i)
4885  If nr_pages == 0 Then nr_pages = nr_pages
4887  If nr_pages != nr_pages Then
4888  nr_pages_same = 0
4889  Break
4893  If Not nr_pages_same Then nr_pages = 2
4895  buffers[cpu] = rb_allocate_cpu_buffer(buffer, nr_pages, cpu)
4897  If Not buffers[cpu] Then
4898  WARN(1, "failed to allocate ring buffer on CPU %u\n", cpu)
4900  Return -ENOMEM
4902  smp_wmb()
4903  pumask_set_cpu - set a cpu in a cpumask*@cpu: cpu number (< nr_cpu_ids)*@dstp: the cpumask pointer
4904  Return 0