免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2138 | 回复: 2
打印 上一主题 下一主题

[数据结构] 关于trace_recursive_lock()的疑问。。。 [复制链接]

论坛徽章:
4
酉鸡
日期:2014-03-21 23:19:50狮子座
日期:2014-08-01 22:11:40酉鸡
日期:2015-01-10 21:31:442015年辞旧岁徽章
日期:2015-03-03 16:54:15
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-02-17 09:18 |只看该作者 |倒序浏览
30可用积分
本帖最后由 chishanmingshen 于 2013-02-23 10:35 编辑

from 3.7.0

  1. /**
  2. * ring_buffer_lock_reserve - reserve a part of the buffer
  3. * @buffer: the ring buffer to reserve from
  4. * @length: the length of the data to reserve (excluding event header)
  5. *
  6. * Returns a reseverd event on the ring buffer to copy directly to.
  7. * The user of this interface will need to get the body to write into
  8. * and can use the ring_buffer_event_data() interface.
  9. *
  10. * The length is the length of the data needed, not the event length
  11. * which also includes the event header.
  12. *
  13. * Must be paired with ring_buffer_unlock_commit, unless NULL is returned.
  14. * If NULL is returned, then nothing has been allocated or locked.
  15. */
  16. struct ring_buffer_event *
  17. ring_buffer_lock_reserve(struct ring_buffer *buffer, unsigned long length)
  18. {
  19.         struct ring_buffer_per_cpu *cpu_buffer;
  20.         struct ring_buffer_event *event;
  21.         int cpu;

  22.         if (ring_buffer_flags != RB_BUFFERS_ON)
  23.                 return NULL;

  24.         /* If we are tracing schedule, we don't want to recurse */<----注释说防止递归!
  25.         preempt_disable_notrace();

  26.         if (atomic_read(&buffer->record_disabled))
  27.                 goto out_nocheck;

  28.         if (trace_recursive_lock())<---------------------------递归计数,如何导致递归?
  29.                 goto out_nocheck;

  30.         cpu = raw_smp_processor_id();

  31.         if (!cpumask_test_cpu(cpu, buffer->cpumask))
  32.                 goto out;

  33.         cpu_buffer = buffer->buffers[cpu];

  34.         if (atomic_read(&cpu_buffer->record_disabled))
  35.                 goto out;

  36.         if (length > BUF_MAX_DATA_SIZE)
  37.                 goto out;

  38.         event = rb_reserve_next_event(buffer, cpu_buffer, length);
  39.         if (!event)
  40.                 goto out;

  41.         return event;

  42. out:
  43.         trace_recursive_unlock();

  44. out_nocheck:
  45.         preempt_enable_notrace();
  46.         return NULL;
  47. }
复制代码
哪种场景会递归调用此函数?求解!谢谢~~

论坛徽章:
4
酉鸡
日期:2014-03-21 23:19:50狮子座
日期:2014-08-01 22:11:40酉鸡
日期:2015-01-10 21:31:442015年辞旧岁徽章
日期:2015-03-03 16:54:15
2 [报告]
发表于 2013-02-21 13:05 |只看该作者
求指点。。。

论坛徽章:
4
酉鸡
日期:2014-03-21 23:19:50狮子座
日期:2014-08-01 22:11:40酉鸡
日期:2015-01-10 21:31:442015年辞旧岁徽章
日期:2015-03-03 16:54:15
3 [报告]
发表于 2013-03-08 15:41 |只看该作者
建议本版增加“调试”或“trace”子版!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP