Function report |
Source Code:kernel\trace\ring_buffer.c |
Create Date:2022-07-28 11:53:41 |
| Last Modify:2020-03-17 19:30:04 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:__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
Proto:struct ring_buffer *__ring_buffer_alloc(unsigned long size, unsigned flags, struct lock_class_key *key)
Type:struct ring_buffer
Parameter:
| Type | Parameter | Name |
|---|---|---|
| unsigned long | size | |
| unsigned | flags | |
| struct lock_class_key * | key |
| 1387 | buffer = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc). |
| 1389 | If Not buffer Then Return NULL |
| 1392 | If Not zalloc_cpumask_var( & cpumask, GFP_KERNEL) Then Go to fail_free_buffer |
| 1395 | nr_pages = DIV_ROUND_UP(size, BUF_PAGE_SIZE) |
| 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) |
| 1409 | bsize = size of * * Setup number of possible processor ids |
| 1410 | buffers = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc). |
| 1412 | If Not buffers Then Go to fail_free_cpumask |
| 1416 | pumask_set_cpu - set a cpu in a cpumask*@cpu: cpu number (< nr_cpu_ids)*@dstp: the cpumask pointer |
| 1418 | If Not buffers[cpu] Then Go to fail_free_buffers |
| 1422 | If ret < 0 Then Go to 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 | Return buffer |
| 1429 | fail_free_buffers : |
| 1430 | for_each_buffer_cpu(buffer, cpu) |
| 1431 | If buffers[cpu] Then rb_free_cpu_buffer(buffers[cpu]) |
| 1436 | fail_free_cpumask : |
| 1437 | free_cpumask_var(cpumask) |
| 1439 | fail_free_buffer : |
| 1441 | Return NULL |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |