函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:__ring_buffer_alloc - allocate a new ring_buffer*@size: the size in bytes per cpu that is needed.*@flags: attributes to set for the ring buffer.* Currently the only flag that is available is the RB_FL_OVERWRITE* flag

函数原型:struct ring_buffer *__ring_buffer_alloc(unsigned long size, unsigned flags, struct lock_class_key *key)

返回类型:struct ring_buffer

参数:

类型参数名称
unsigned longsize
unsignedflags
struct lock_class_key *key
1387  buffer等于分配内存并置零
1389  如果非buffer则返回:NULL
1392  如果非zalloc_cpumask_var( & cpumask, GFP_KERNEL)则转到:fail_free_buffer
1395  nr_pages等于DIV_ROUND_UP(size, BUF_PAGE_SIZE)
1396  flags等于flags
1397  clock等于race_clock_local(): the simplest and least coherent tracing clock.* Useful for tracing that does not cross to other CPUs nor* does it go through idle events.
1398  reader_lock_key等于key
1400  init_irq_work( & work, _wake_up_waiters - wake up tasks waiting for ring buffer input* Schedules a delayed work to wake up any task that is blocked on the* ring buffer waiters queue.)
1401  init_waitqueue_head( & waiters)
1404  如果nr_pages小于2则nr_pages等于2
1407  cpus等于CPU数量
1409  bsize等于*的长度乘CPU数量
1410  buffers等于分配内存并置零
1412  如果非buffers则转到:fail_free_cpumask
1415  cpu等于These macros fold the SMP functionality into a single CPU system()
1416  设置CPU信息
1417  buffers[cpu]等于rb_allocate_cpu_buffer(buffer, nr_pages, cpu)
1418  如果非buffers[cpu]则转到:fail_free_buffers
1421  ret等于puhp_state_add_instance - Add an instance for a state and invoke startup* callback.*@state: The state for which the instance is installed*@node: The node for this individual state.* Installs the instance for the @state and invokes the startup callback on
1422  如果ret小于0则转到:fail_free_buffers
1425  mutex_init - initialize the mutex*@mutex: the mutex to be initialized* Initialize the mutex to unlocked state.* It is not allowed to initialize an already locked mutex.( & mutex)
1427  返回:buffer
1429  fail_free_buffers :
1430  for_each_buffer_cpu(buffer, cpu)
1431  如果buffers[cpu]则rb_free_cpu_buffer(buffers[cpu])
1434  kfree(buffers)
1436  fail_free_cpumask :
1437  释放CPU掩码
1439  fail_free_buffer :
1440  kfree(buffer)
1441  返回:NULL