在走读io_uring代码时,遇到

static inline bool io_run_task_work(void)
{
if (test_thread_flag(TIF_NOTIFY_SIGNAL) || current->task_works) {
__set_current_state(TASK_RUNNING);
tracehook_notify_signal();
return true;
}
return false;
}

搜索资料,然后搜出下面这个补丁,挺有意思的性能优化

1) TIF_NOTIFY_SIGNAL
​​​ https://www.phoronix.com/scan.php?page=news_item&px=Decouple-TASK_WORK-TWA_SIGNAL​

​https://lore.kernel.org/lkml/3ce9e205-aad0-c9ce-86a7-b281f1c0237a@kernel.dk/​


task work机制可以在内核中向指定的进程添加一些任务函数,这些任务函数会在进程返回用户态时执行,使用的是该进程的上下文。包括下面的这些API:

  • task_work_add
  • task_work_cancel
  • task_work_run

2) syzkaller
​​​ https://syzkaller.appspot.com/bug?id=2a7c2b19f9e36bf21692ecf7491324b20a407529​

3) 支持dm
​​​ https://lore.kernel.org/linux-block/20201223112624.78955-1-jefflexu@linux.alibaba.com/T/#t​