函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:g_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.

函数原型:int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size, int cpu_id)

返回类型:int

参数:

类型参数名称
struct ring_buffer *buffer
unsigned longsize
intcpu_id
1720  err等于0
1725  如果非buffer则返回:size
1729  如果cpu_id不等于RING_BUFFER_ALL_CPUS且非测试CPU信息则返回:size
1733  nr_pages等于DIV_ROUND_UP(size, BUF_PAGE_SIZE)
1736  如果nr_pages小于2则nr_pages等于2
1739  size等于nr_pagesBUF_PAGE_SIZE
1746  如果atomic_read( & resize_disabled)则返回:负EBUSY
1750  mutex_lock( & mutex)
1752  如果cpu_id恒等于RING_BUFFER_ALL_CPUS
1755  cpu_buffer等于buffers[cpu]
1762  如果g buffer pages to update, > 0 to add, < 0 to remove 小于等于0则继续下一循环
1772  err等于负ENOMEM
1773  转到:out_err
1777  get_online_cpus()
1784  cpu_buffer等于buffers[cpu]
1785  如果非g buffer pages to update, > 0 to add, < 0 to remove 则继续下一循环
1789  如果非cpu_online(cpu)则
1792  否则
1800  cpu_buffer等于buffers[cpu]
1801  如果非g buffer pages to update, > 0 to add, < 0 to remove 则继续下一循环
1809  put_online_cpus()
1810  否则
1812  如果非测试CPU信息则转到:out
1815  cpu_buffer等于buffers[cpu_id]
1817  如果nr_pages恒等于nr_pages则转到:out
1820  g buffer pages to update, > 0 to add, < 0 to remove 等于nr_pagesnr_pages
1823  初始化链表头
1827  err等于负ENOMEM
1828  转到:out_err
1831  get_online_cpus()
1834  如果非cpu_online(cpu_id)则rb_update_pages(cpu_buffer)
1836  否则
1842  g buffer pages to update, > 0 to add, < 0 to remove 等于0
1843  put_online_cpus()
1846  out :
1854  如果atomic_read( & record_disabled)则
1855  atomic_inc( & record_disabled)
1862  Wait for a grace period to elapse. But it is illegal to invoke* synchronize_rcu() from within an RCU read-side critical section.* Therefore, any legal call to synchronize_rcu() is a quiescent
1864  cpu_buffer等于buffers[cpu]
1867  atomic_dec( & record_disabled)
1870  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
1871  返回:size
1873  out_err :
1874  for_each_buffer_cpu(buffer, cpu)
1877  cpu_buffer等于buffers[cpu]
1878  g buffer pages to update, > 0 to add, < 0 to remove 等于0
1880  如果链表为空则继续下一循环
1885  删除链表项并重新初始化
1886  Also stolen from mm/slob.c. Thanks to Mathieu Desnoyers for pointing* this issue out.
1889  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
1890  返回:err
调用者
名称描述
__tracing_resize_ring_buffer