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:10
Last Modify:2020-03-17 19:30:04 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:g_buffer_wait - wait for input to the ring buffer*@buffer: buffer to wait on*@cpu: the cpu buffer to wait on*@full: wait until a full page is available, if @cpu != RING_BUFFER_ALL_CPUS* If @cpu == RING_BUFFER_ALL_CPUS then the task will wake up as soon

Proto:int ring_buffer_wait(struct ring_buffer *buffer, int cpu, int full)

Type:int

Parameter:

TypeParameterName
struct ring_buffer *buffer
intcpu
intfull
578  cpu_buffer = cpu_buffer
579  DEFINE_WAIT(wait)
581  ret = 0
588  If cpu == RING_BUFFER_ALL_CPUS Then
589  work = irq_work
591  full = 0
592  Else
593  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 Return -ENODEV
595  cpu_buffer = buffers[cpu]
596  work = irq_work
600  When (true) cycle
601  If full Then Note: we use "set_current_state()" _after_ the wait-queue add,* because we need a memory barrier there on SMP, so that any* wake-function that tests for the wait-queue being active* will be guaranteed to see waitqueue addition _or_ subsequent
603  Else Note: we use "set_current_state()" _after_ the wait-queue add,* because we need a memory barrier there on SMP, so that any* wake-function that tests for the wait-queue being active* will be guaranteed to see waitqueue addition _or_ subsequent
626  If full Then full_waiters_pending = true
628  Else waiters_pending = true
632  ret = -EINTR
633  Break
636  If cpu == RING_BUFFER_ALL_CPUS && Not d_buffer_empty - is the ring buffer empty?*@buffer: The ring buffer to test Then Break
646  If Not full Then Break
651  nr_pages = nr_pages
657  If Not pagebusy && ( Not nr_pages || dirty * 100 > full * nr_pages ) Then Break
662  schedule()
665  If full Then sh_wait - clean up after waiting in a queue*@wq_head: waitqueue waited on*@wq_entry: wait descriptor* Sets current thread back to running state and removes* the wait descriptor from the given waitqueue if still* queued.
667  Else sh_wait - clean up after waiting in a queue*@wq_head: waitqueue waited on*@wq_entry: wait descriptor* Sets current thread back to running state and removes* the wait descriptor from the given waitqueue if still* queued.
670  Return ret
Caller
NameDescribe
wait_on_pipe