函数逻辑报告 |
Source Code:kernel\trace\ring_buffer.c |
Create Date:2022-07-27 12:58:58 |
Last Modify:2020-03-17 19:30:04 | Copyright©Brick |
首页 | 函数Tree |
注解内核,赢得工具 | 下载SCCT | English |
函数名称:rb_allocate_cpu_buffer
函数原型:static struct ring_buffer_per_cpu *rb_allocate_cpu_buffer(struct ring_buffer *buffer, long nr_pages, int cpu)
返回类型:struct ring_buffer_per_cpu
参数:
类型 | 参数 | 名称 |
---|---|---|
struct ring_buffer * | buffer | |
long | nr_pages | |
int | cpu |
1293 | cpu_buffer等于根据内存节点分配内存 |
1295 | 如果非cpu_buffer则返回:NULL |
1300 | raw_spin_lock_init( & serialize readers ) |
1301 | lockdep_set_class( & serialize readers , reader_lock_key) |
1302 | lock = (arch_spinlock_t) |
1303 | INIT_WORK( & update_pages_work, update_pages_handler) |
1304 | init_completion( & update_done) |
1305 | 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.) |
1306 | init_waitqueue_head( & waiters) |
1307 | init_waitqueue_head( & full_waiters) |
1309 | bpage等于根据内存节点分配内存 |
1311 | 如果非bpage则转到:fail_free_buffer |
1314 | rb_check_bpage(cpu_buffer, bpage) |
1316 | reader_page等于bpage |
1317 | 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. |
1318 | 如果非page则转到:fail_free_reader |
1320 | Actual data page 等于page_address(page) |
1321 | rb_init_page(Actual data page ) |
1323 | 初始化链表头 |
1324 | 初始化链表头 |
1326 | ret等于rb_allocate_pages(cpu_buffer, nr_pages) |
1327 | 如果ret小于0则转到:fail_free_reader |
1332 | write to tail 等于committed pages 等于ad from head |
1336 | 返回:cpu_buffer |
1338 | fail_free_reader : |
1341 | fail_free_buffer : |
1342 | kfree(cpu_buffer) |
1343 | 返回:NULL |
名称 | 描述 |
---|---|
__ring_buffer_alloc | __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 |
trace_rb_cpu_prepare | 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. |
源代码转换工具 开放的插件接口 | X |
---|---|
支持:c/c++/esqlc/java Oracle/Informix/Mysql 插件可实现:逻辑报告 代码生成和批量转换代码 |