Skip to content

Commit ca136b2

Browse files
repkmartinetd
authored andcommitted
wait: Introduce io_wait_event_killable()
Add io_wait_event_killable(), a variant of wait_event_killable() that uses io_schedule() instead of schedule(). This is to be used in situation where waiting time is to be accounted as IO wait time. Signed-off-by: Remi Pommarel <repk@triplefau.lt> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Message-ID: <1b2870001ecd34fe6c05be2ddfefb3c798b11701.1769179462.git.repk@triplefau.lt> Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
1 parent 63804fe commit ca136b2

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

include/linux/wait.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,21 @@ extern int do_wait_intr_irq(wait_queue_head_t *, wait_queue_entry_t *);
937937
__ret; \
938938
})
939939

940+
#define __io_wait_event_killable(wq, condition) \
941+
___wait_event(wq, condition, TASK_KILLABLE, 0, 0, io_schedule())
942+
943+
/*
944+
* wait_event_killable() - link wait_event_killable but with io_schedule()
945+
*/
946+
#define io_wait_event_killable(wq_head, condition) \
947+
({ \
948+
int __ret = 0; \
949+
might_sleep(); \
950+
if (!(condition)) \
951+
__ret = __io_wait_event_killable(wq_head, condition); \
952+
__ret; \
953+
})
954+
940955
#define __wait_event_state(wq, condition, state) \
941956
___wait_event(wq, condition, state, 0, 0, schedule())
942957

0 commit comments

Comments
 (0)