Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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 activityDownload SCCTChinese

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:

TypeParameterName
struct ring_buffer *buffer
unsigned longsize
intcpu_id
1720  err = 0
1725  If Not buffer Then Return size
1729  If cpu_id != RING_BUFFER_ALL_CPUS && 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 Return size
1733  nr_pages = DIV_ROUND_UP(size, BUF_PAGE_SIZE)
1736  If nr_pages < 2 Then nr_pages = 2
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
1755  cpu_buffer = buffers[cpu]
1772  err = -ENOMEM
1773  Go to out_err
1777  get_online_cpus()
1784  cpu_buffer = buffers[cpu]
1789  If Not cpu_online(cpu) Then
1792  Else
1800  cpu_buffer = buffers[cpu]
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]
1817  If nr_pages == nr_pages Then Go to out
1820  g buffer pages to update, > 0 to add, < 0 to remove = nr_pages - nr_pages
1823  Initialization list head
1827  err = -ENOMEM
1828  Go to out_err
1831  get_online_cpus()
1834  If Not cpu_online(cpu_id) Then rb_update_pages(cpu_buffer)
1836  Else
1842  g buffer pages to update, > 0 to add, < 0 to remove = 0
1843  put_online_cpus()
1846  out :
1854  If atomic_read( & record_disabled) Then
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  Return 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  If list_empty - tests whether a list is empty*@head: the list to test. Then Continue
1885  list_del_init - deletes entry from list and reinitialize it.*@entry: the element to delete from the list.
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  Return err
Caller
NameDescribe
__tracing_resize_ring_buffer