Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2064314pxa; Mon, 3 Aug 2020 06:39:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhxfJcaE/D8clA+TO3EBURug9gx8zQ8pch3EeVb0XiDm68SrU8AURibyHELLEKhAcy8t1z X-Received: by 2002:a05:6402:174d:: with SMTP id v13mr7088727edx.231.1596461963748; Mon, 03 Aug 2020 06:39:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596461963; cv=none; d=google.com; s=arc-20160816; b=Wnb8mmdfFfLBB7mlNzI1ULfxLoC7fBEtBBblbNFMuy8GKYfu0yMuC2PabFWosediWy N3DA+mbPdUS7d1QYRyv5Ty3eoRBkq4GWvHXZq7Y9iH7Mx4x0ihfhuXCFsXRwSejjz4q1 wdG9UKMOMWOVGLHBqaYw9mrQG0c+oxbShAQA/3tJ29tzNdCQ/PHjaR6qCbrhci796fKG Gti4oX/TudP1oaGuYzuyGf5eEZwQWpwVyK9OAAgoBjl0NzxVESHW826+WaxyePXHBpBj YNhT4AOvjb53EIvFROLmS5wq7ML24wDjbB2ykGPgZPs4TBVEx7aEZyPfDRfEwfV0PpBI VPXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=GF5NkU1Owa5eZCpSThUERjt0ONcFG8WTLeHpFY0eUC8=; b=M+nrtJ9L6Z1PC2uyc7iX/z9hKrx8tyDoqIwe67m8WIQVbATsX6D1TH6icwPBVAYoMg QcWtONo2akEzHRuKQE3UqsWgxjBkGEPCvoiCVFLdKB/elNBgU1m7Hv6inbCUQpIkhhNI 27XRgLj3PB0qTd6qJR8mzSeKHvAKDiMAGa5pxTJLF+RuBU1tJTzD40dcAERFoZ1DeOz2 Hr+ZdtBsayl2MDp7h8Vqu0f8zVmGa+Ogjn6fACFRB4k2YhmsWBerd/FtSkrgyoaf7r3z kq58bsOFgXly/bhd0tinEJo2JIC2sMHc34p9foHz+g0agQweazsh1bxz/H6j6VYyDes3 TbXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@126.com header.s=s110527 header.b=Ozwq4TKA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=126.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x10si345830ejv.339.2020.08.03.06.39.01; Mon, 03 Aug 2020 06:39:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@126.com header.s=s110527 header.b=Ozwq4TKA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=126.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727897AbgHCNiL (ORCPT + 99 others); Mon, 3 Aug 2020 09:38:11 -0400 Received: from m15112.mail.126.com ([220.181.15.112]:43282 "EHLO m15112.mail.126.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728213AbgHCNiH (ORCPT ); Mon, 3 Aug 2020 09:38:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=126.com; s=s110527; h=From:Subject:Date:Message-Id; bh=GF5NkU1Owa5eZCpSTh UERjt0ONcFG8WTLeHpFY0eUC8=; b=Ozwq4TKAKvCRm+AUmeZy2NaxuxjEyRjHkF XRwO05xF6XV0aQtCH4SWIrNxbkiLGWH63LZS8lQfIpYl7viyVarXzAW4rgQAvG9T wSPKtwQKfQNHRz6d474ff8EaOHxyPUZ3f5rlx2AOXmO2t5+MywOiek743sEBWScJ /y3/nC3qs= Received: from 192.168.137.249 (unknown [112.10.84.202]) by smtp2 (Coremail) with SMTP id DMmowADXsfLwEihfNwDqFw--.30116S3; Mon, 03 Aug 2020 21:36:49 +0800 (CST) From: Xianting Tian 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 Message-Id: <1596461807-21087-1-git-send-email-xianting_tian@126.com> X-Mailer: git-send-email 1.8.3.1 X-CM-TRANSID: DMmowADXsfLwEihfNwDqFw--.30116S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrZw4rKr1ktFy8Aw4xXr4kXrb_yoWfuwcEk3 yxKrna9w1YkF97ur13Cay3J34UKayI9F4UZF4jgFy5t34Iva4UXF1xtFs3XF1fX3yjvayD GFZ0yFWUAr42gjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU8WE_tUUUUU== X-Originating-IP: [112.10.84.202] X-CM-SenderInfo: h0ld03plqjs3xldqqiyswou0bp/1tbiHhR1pF16HThDMwAAsp Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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