Skip to content

Commit

Permalink
mm/page_io.c: use blk_io_schedule() for avoiding task hung in sync io
Browse files Browse the repository at this point in the history
swap_readpage() does the sync io for one page, the io is not big,
normally, the io can be finished quickly, but it may take long time or
wait forever in case of io failure or discard.

This patch uses blk_io_schedule() instead of io_schedule() to avoid task
hung and crash (when set /proc/sys/kernel/hung_task_panic) when the above
exception occurs.

This is similar to the hung task avoidance in submit_bio_wait(),
blk_execute_rq() and __blkdev_direct_IO().

Signed-off-by: Xianting Tian <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Cc: Ming Lei <[email protected]>
Cc: Bart Van Assche <[email protected]>
Cc: Hannes Reinecke <[email protected]>
Cc: Jens Axboe <[email protected]>
Cc: Hugh Dickins <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Xianting Tian authored and torvalds committed Aug 7, 2020
1 parent 27ec487 commit 0f190a7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/page_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ int swap_readpage(struct page *page, bool synchronous)
break;

if (!blk_poll(disk->queue, qc, true))
io_schedule();
blk_io_schedule();
}
__set_current_state(TASK_RUNNING);
bio_put(bio);
Expand Down

0 comments on commit 0f190a7

Please sign in to comment.