History

task_work: Decouple TIF_NOTIFY_SIGNAL and task_work

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.

Eric W. Biederman committed 4 years ago

Commit 7c5d8fa1 parent 8ba62d34 files · +13 −17Browse files

Showing the changes to kernel (1 of 4 files). Show all

Unified · Split

kernel/entry/kvm.c+5−2
@@ -8,8 +8,11 @@ static int xfer_to_guest_mode_work(struct kvm_vcpu *vcpu, unsigned long ti_work) · 7 unmodified lines
88 do {
99 int ret;
1010
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+ }
1316
1417 if (ti_work & _TIF_SIGPENDING) {
1518 kvm_handle_signal_exit(vcpu);