From: Xianting Tian Date: Fri, 7 Aug 2020 06:20:17 +0000 (-0700) Subject: mm/page_io.c: use blk_io_schedule() for avoiding task hung in sync io X-Git-Tag: nvme-5.9-2020-09-10~144^2~105 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=0f190a7ab78878f9e6c6930fc0f5f92c1250b57d;p=nvme.git mm/page_io.c: use blk_io_schedule() for avoiding task hung in sync io 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 Signed-off-by: Andrew Morton Reviewed-by: Andrew Morton Cc: Ming Lei Cc: Bart Van Assche Cc: Hannes Reinecke Cc: Jens Axboe Cc: Hugh Dickins Link: http://lkml.kernel.org/r/1596461807-21087-1-git-send-email-xianting_tian@126.com Signed-off-by: Linus Torvalds --- diff --git a/mm/page_io.c b/mm/page_io.c index ccda76790088..9e362567d454 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -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);