From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03670C433DF for ; Fri, 7 Aug 2020 06:20:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B99FE221E5 for ; Fri, 7 Aug 2020 06:20:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="f2AXjbDy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B99FE221E5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 533118D0041; Fri, 7 Aug 2020 02:20:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E2D68D0026; Fri, 7 Aug 2020 02:20:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3F8FC8D0041; Fri, 7 Aug 2020 02:20:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0182.hostedemail.com [216.40.44.182]) by kanga.kvack.org (Postfix) with ESMTP id 260D08D0026 for ; Fri, 7 Aug 2020 02:20:20 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id E1A171730840 for ; Fri, 7 Aug 2020 06:20:19 +0000 (UTC) X-FDA: 77122772958.11.soup44_010372f26fbe Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id B327E180F8B80 for ; Fri, 7 Aug 2020 06:20:19 +0000 (UTC) X-HE-Tag: soup44_010372f26fbe X-Filterd-Recvd-Size: 2888 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Fri, 7 Aug 2020 06:20:19 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 24BEC2177B; Fri, 7 Aug 2020 06:20:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596781218; bh=5Ljwl9+hAOQKO5kGK9vO0ejknpmWlSa6fzSTlSSNcoE=; h=Date:From:To:Subject:In-Reply-To:From; b=f2AXjbDyMWjyzmrSNonI+3C05GJklJI5EUBWwivLVQlqf1M8NSe/OBfKT6UR9EFGk T7CHVyBz2v/hvn/K50HRZFGMpEnBJQgSokSHiv5A4I7hb424IWwPzhsvCX3kajYRKk 2wCf2F2PO3S9zOsVF/LEBASRVsaIyFz3TApLv33w= Date: Thu, 06 Aug 2020 23:20:17 -0700 From: Andrew Morton To: akpm@linux-foundation.org, axboe@kernel.dk, bvanassche@acm.org, hare@suse.de, hughd@google.com, linux-mm@kvack.org, ming.lei@redhat.com, mm-commits@vger.kernel.org, torvalds@linux-foundation.org, xianting_tian@126.com Subject: [patch 058/163] mm/page_io.c: use blk_io_schedule() for avoiding task hung in sync io Message-ID: <20200807062017.4V6PayTV1%akpm@linux-foundation.org> In-Reply-To: <20200806231643.a2711a608dd0f18bff2caf2b@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Queue-Id: B327E180F8B80 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Xianting Tian Subject: 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(). Link: http://lkml.kernel.org/r/1596461807-21087-1-git-send-email-xianting_tian@126.com Signed-off-by: Xianting Tian Reviewed-by: Andrew Morton Cc: Ming Lei Cc: Bart Van Assche Cc: Hannes Reinecke Cc: Jens Axboe Cc: Hugh Dickins Signed-off-by: Andrew Morton --- mm/page_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/page_io.c~mm-use-blk_io_schedule-for-avoiding-task-hung-in-sync-io +++ a/mm/page_io.c @@ -441,7 +441,7 @@ int swap_readpage(struct page *page, boo break; if (!blk_poll(disk->queue, qc, true)) - io_schedule(); + blk_io_schedule(); } __set_current_state(TASK_RUNNING); bio_put(bio); _