There are a small handful of reasons besides pending signals that the kernel might want to break out of interruptible sleeps. The flag TIF_NOTIFY_SIGNAL and the helpers that set and clear TIF_NOTIFY_SIGNAL provide that the infrastructure for breaking out of interruptible sleeps and entering the return to user space slow path for those cases. Expand tracehook_notify_signal inline in it's callers and remove it, which makes clear that TIF_NOTIFY_SIGNAL and task_work are separate concepts. Update the comment on set_notify_signal to more accurately describe it's purpose.
Showing the changes to kernel (1 of 4 files). Show all
Unified · Split
| @@ -8,8 +8,11 @@ static int xfer_to_guest_mode_work(struct kvm_vcpu *vcpu, unsigned long ti_work) · 7 unmodified lines | ||
| 8 | 8 | do { |
| 9 | 9 | int ret; |
| 10 | 10 | |
| 11 | − if (ti_work & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL)) | |
| 12 | − tracehook_notify_signal(); | |
| 11 | + if (ti_work & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL)) { | |
| 12 | + clear_notify_signal(); | |
| 13 | + if (task_work_pending(current)) | |
| 14 | + task_work_run(); | |
| 15 | + } | |
| 13 | 16 | |
| 14 | 17 | if (ti_work & _TIF_SIGPENDING) { |
| 15 | 18 | kvm_handle_signal_exit(vcpu); |