struct task_struct *waiter = bio->bi_private;
 
        WRITE_ONCE(bio->bi_private, NULL);
-       wake_up_process(waiter);
+       blk_wake_io_task(waiter);
 }
 
 static ssize_t
                        struct task_struct *waiter = dio->waiter;
 
                        WRITE_ONCE(dio->waiter, NULL);
-                       wake_up_process(waiter);
+                       blk_wake_io_task(waiter);
                }
        }
 
 
                if (dio->wait_for_completion) {
                        struct task_struct *waiter = dio->submit.waiter;
                        WRITE_ONCE(dio->submit.waiter, NULL);
-                       wake_up_process(waiter);
+                       blk_wake_io_task(waiter);
                } else if (dio->flags & IOMAP_DIO_WRITE) {
                        struct inode *inode = file_inode(dio->iocb->ki_filp);
 
 
 
 #endif /* CONFIG_BLOCK */
 
+static inline void blk_wake_io_task(struct task_struct *waiter)
+{
+       /*
+        * If we're polling, the task itself is doing the completions. For
+        * that case, we don't need to signal a wakeup, it's enough to just
+        * mark us as RUNNING.
+        */
+       if (waiter == current)
+               __set_current_state(TASK_RUNNING);
+       else
+               wake_up_process(waiter);
+}
+
 #endif
 
        unlock_page(page);
        WRITE_ONCE(bio->bi_private, NULL);
        bio_put(bio);
-       wake_up_process(waiter);
+       blk_wake_io_task(waiter);
        put_task_struct(waiter);
 }