- 论坛徽章:
- 4
|
30可用积分
本帖最后由 chishanmingshen 于 2013-02-23 10:35 编辑
from 3.7.0
- /**
- * ring_buffer_lock_reserve - reserve a part of the buffer
- * @buffer: the ring buffer to reserve from
- * @length: the length of the data to reserve (excluding event header)
- *
- * Returns a reseverd event on the ring buffer to copy directly to.
- * The user of this interface will need to get the body to write into
- * and can use the ring_buffer_event_data() interface.
- *
- * The length is the length of the data needed, not the event length
- * which also includes the event header.
- *
- * Must be paired with ring_buffer_unlock_commit, unless NULL is returned.
- * If NULL is returned, then nothing has been allocated or locked.
- */
- struct ring_buffer_event *
- ring_buffer_lock_reserve(struct ring_buffer *buffer, unsigned long length)
- {
- struct ring_buffer_per_cpu *cpu_buffer;
- struct ring_buffer_event *event;
- int cpu;
- if (ring_buffer_flags != RB_BUFFERS_ON)
- return NULL;
- /* If we are tracing schedule, we don't want to recurse */<----注释说防止递归!
- preempt_disable_notrace();
- if (atomic_read(&buffer->record_disabled))
- goto out_nocheck;
- if (trace_recursive_lock())<---------------------------递归计数,如何导致递归?
- goto out_nocheck;
- cpu = raw_smp_processor_id();
- if (!cpumask_test_cpu(cpu, buffer->cpumask))
- goto out;
- cpu_buffer = buffer->buffers[cpu];
- if (atomic_read(&cpu_buffer->record_disabled))
- goto out;
- if (length > BUF_MAX_DATA_SIZE)
- goto out;
- event = rb_reserve_next_event(buffer, cpu_buffer, length);
- if (!event)
- goto out;
- return event;
- out:
- trace_recursive_unlock();
- out_nocheck:
- preempt_enable_notrace();
- return NULL;
- }
复制代码 哪种场景会递归调用此函数?求解!谢谢~~
|
|