| Function report | 
| Source Code: kernel\events\ring_buffer.c | Create Date:2022-07-28 13:42:45 | 
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name:rb_alloc
Proto:struct ring_buffer *rb_alloc(int nr_pages, long watermark, int cpu, int flags)
Type:struct ring_buffer
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| int | nr_pages | |
| long | watermark | |
| int | cpu | |
| int | flags | 
| 807 | size = sizeof(structring_buffer) | 
| 813 | rb = 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). | 
| 817 | user_page = perf_mmap_alloc_page(cpu) | 
| 818 | If Not user_page Then Go to fail_user_page | 
| 822 | data_pages[i] = perf_mmap_alloc_page(cpu) | 
| 823 | If Not data_pages[i] Then Go to fail_data_pages | 
| 827 | nr of data pages = nr_pages | 
| 829 | ring_buffer_init(rb, watermark, flags) | 
| 831 | Return rb | 
| 833 | fail_data_pages : | 
| 834 | When i >= 0 cycle perf_mmap_free_page(data_pages[i]) | 
| 839 | fail_user_page : | 
| 842 | fail : | 
| 843 | 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 |