| Function report | 
| Source Code: kernel\trace\ring_buffer.c | Create Date:2022-07-28 11:53:58 | 
| Last Modify:2020-03-17 19:30:04 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name: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.
Proto:int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size, int cpu_id)
Type:int
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| struct ring_buffer * | buffer | |
| unsigned long | size | |
| int | cpu_id | 
| 1720 | err = 0 | 
| 1733 | nr_pages = DIV_ROUND_UP(size, BUF_PAGE_SIZE) | 
| 1739 | size = nr_pages * BUF_PAGE_SIZE | 
| 1746 | If atomic_read( & resize_disabled) Then Return -EBUSY | 
| 1750 | mutex_lock( & mutex) | 
| 1752 | If cpu_id == RING_BUFFER_ALL_CPUS Then | 
| 1754 | for_each_buffer_cpu(buffer, cpu) | 
| 1755 | cpu_buffer = buffers[cpu] | 
| 1762 | If g buffer pages to update, > 0 to add, < 0 to remove <= 0 Then Continue | 
| 1769 | If __rb_allocate_pages(g buffer pages to update, > 0 to add, < 0 to remove , & w pages to add , cpu) Then | 
| 1777 | get_online_cpus() | 
| 1783 | for_each_buffer_cpu(buffer, cpu) | 
| 1784 | cpu_buffer = buffers[cpu] | 
| 1785 | If Not g buffer pages to update, > 0 to add, < 0 to remove Then Continue | 
| 1789 | If Not cpu_online(cpu) Then | 
| 1792 | Else | 
| 1799 | for_each_buffer_cpu(buffer, cpu) | 
| 1800 | cpu_buffer = buffers[cpu] | 
| 1801 | If Not g buffer pages to update, > 0 to add, < 0 to remove Then Continue | 
| 1809 | put_online_cpus() | 
| 1810 | Else | 
| 1812 | If Not 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 Go to out | 
| 1815 | cpu_buffer = buffers[cpu_id] | 
| 1831 | get_online_cpus() | 
| 1834 | If Not cpu_online(cpu_id) Then rb_update_pages(cpu_buffer) | 
| 1836 | Else | 
| 1843 | put_online_cpus() | 
| 1846 | out : | 
| 1854 | If atomic_read( & record_disabled) Then | 
| 1855 | atomic_inc( & record_disabled) | 
| 1863 | for_each_buffer_cpu(buffer, cpu) | 
| 1864 | cpu_buffer = buffers[cpu] | 
| 1867 | atomic_dec( & record_disabled) | 
| 1871 | Return size | 
| 1873 | out_err : | 
| 1874 | for_each_buffer_cpu(buffer, cpu) | 
| 1877 | cpu_buffer = buffers[cpu] | 
| 1880 | If list_empty - tests whether a list is empty*@head: the list to test. Then Continue | 
| 1890 | Return err | 
| Name | Describe | 
|---|---|
| __tracing_resize_ring_buffer | 
| 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 |