着重看futex_wait_setup和两个函数futex_wait_queue_me staticintfutex_wait_setup(u32__user *uaddr,u32val, int fshared,structfutex_q*q,structfutex_hash_bucket**hb){u32uval; int ret; retry: q->key = FUTEX_KEY_INIT;//初始化futex_qret =get_futex_key(uaddr, fshared, &q->key, VERI...
struct plist_head chain;};static struct futex_hash_bucket futex_queues[1<<FUTEX_HASHBITS]; 着重看futex_wait_setup和两个函数futex_wait_queue_me static int futex_wait_setup(u32 __user *uaddr, u32 val, int fshared, struct futex_q *q, struct futex_hash_bucket **hb){ u32 uval; int...
futex_wait_queue_me(hb, &q, to); /* If we were woken (and unqueued), we succeeded, whatever. */ ret = 0; //如果unqueue_me成功,则说明是超时触发(因为futex_wake唤醒时,会将该进程移出等待队列,所以这里会失败) if (!unqueue_me(&q)) goto out_put_key; ret = -ETIMEDOUT; if (to ...
staticvoidfutex_wait_queue_me(struct futex_hash_bucket*hb,struct futex_q*q,struct hrtimer_sleeper*timeout){//设置进程状态为TASK_INTERRUPTIBLE,cpu调度时只会选择//状态为TASK_RUNNING的进程set_current_state(TASK_INTERRUPTIBLE);//将当期进程(q封装)插入到等待队列中去,然后释放自旋锁queue_me(q,hb);/...
// kernel/futex.c:2571 static void futex_wait_queue_me(...) { ... // 这里可以看到,调用 futex 的进程将变为睡眠状态,与我们的认知一致 set_current_state(TASK_INTERRUPTIBLE); // :2580 ... freezable_schedule(); // :2598 ...
5) ! 273.311 us | } /* futex_wait_queue_me */ 在这个图中,DURATION表示运行一个函数所花费的时间。注意 + 和 ! 符号。加号(+)表示函数耗时超过10微秒,而感叹号(!)表示耗时超过100微秒。在FUNCTION_CALLS下面,我们找到与每个函数调用相关的信息。用于显示每个函数的起始和完成的符号与C编程语言中的相同:括...
// kernel/futex.c:2571 staticvoidfutex_wait_queue_me(...){ ... // 这里可以看到,调用 futex 的进程将变为睡眠状态,与我们的认知一致 set_current_state(TASK_INTERRUPTIBLE);// :2580 ... freezable_schedule;// :2598 ... } // include/linux/freezer.h:169 ...
8 105 44 futex_wait_queue_me futex_wait do_futex SyS_futex system_call_fastpath 0x7f6365a167bc 每一行前三个数字分别是后面代码执行的次数、总共执行延迟时间(单位是微秒)和最长执行延迟时间(单位是微秒)。后面则是代码完整的调用栈。 /proc/[pid]/maps ...
内核编译时打开了 CONFIG_HAVE_ARCH_TRACEHOOK 编译选项,才会生成这个文件。 /proc/[pid]/wchan /proc/[pid]/wchan 显示当进程 sleep 时,kernel 当前运行的函数。举例如下: $ cat /proc/2406/wchanfutex_wait_queue_meadmin 参考文档 http://www.google.com...
#6: <0000000000000000>, hrtimer_wakeup, S:01, futex_wait_queue_me, pool/4029 # expires at 454196319000-454196369000 nsecs [in 5686461796 to 5686511796 nsecs] #7: <0000000000000000>, hrtimer_wakeup, S:01, schedule_hrtimeout_range_clock, nmbd/2118 ...