为什么在信号量代码的down函数之前使用关键字sched?

时间:2014-03-23 21:28:46

标签: linux-kernel

   `static noinline void __sched __down(struct semaphore *sem)`

在上面的函数中,为什么__scehd在信号量代码的__down函数之前使用

1 个答案:

答案 0 :(得分:2)

__sched是一个宏而不是关键字,为该函数添加一个属性,将其视为一些添加的元信息。

<linux/sched.h>中所定义:

/* Attach to any functions which should be ignored in wchan output. */
#define __sched         __attribute__((__section__(".sched.text")))

因此,将__sched宏添加到函数会导致压缩该函数的wchan信息。