linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xianting Tian <xianting_tian@126.com>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH] mm: use blk_io_schedule() for avoiding task hung in sync io
Date: Mon,  3 Aug 2020 09:36:47 -0400	[thread overview]
Message-ID: <1596461807-21087-1-git-send-email-xianting_tian@126.com> (raw)

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 is to use blk_io_schedule() instead of io_schedule() to avoid
task hung and crash(when set /proc/sys/kernel/hung_task_panic) in case of
above exception occur.
We have prevented task hung in submit_bio_wait(), blk_execute_rq() and
__blkdev_direct_IO().

Signed-off-by: Xianting Tian <xianting_tian@126.com>
---
 mm/page_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/page_io.c b/mm/page_io.c
index e8726f3..5d52f7b 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -424,7 +424,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);
-- 
1.8.3.1


                 reply	other threads:[~2020-08-03 13:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1596461807-21087-1-git-send-email-xianting_tian@126.com \
    --to=xianting_tian@126.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).