From patchwork Sun Jul 11 15:09:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew Wilcox (Oracle)" X-Patchwork-Id: 12369207 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=-11.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 57743C07E96 for ; Sun, 11 Jul 2021 15:09:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BFCA96115A for ; Sun, 11 Jul 2021 15:09:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BFCA96115A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 919436B0083; Sun, 11 Jul 2021 11:09:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8D4F66B0081; Sun, 11 Jul 2021 11:09:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CC106B0083; Sun, 11 Jul 2021 11:09:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0022.hostedemail.com [216.40.44.22]) by kanga.kvack.org (Postfix) with ESMTP id 411076B0082 for ; Sun, 11 Jul 2021 11:09:58 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 4E28020BC7 for ; Sun, 11 Jul 2021 15:09:57 +0000 (UTC) X-FDA: 78350642034.15.DEB53A1 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf14.hostedemail.com (Postfix) with ESMTP id 0E8FD60019A2; Sun, 11 Jul 2021 15:09:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=mFET4wlpyMvzyMW7HkmA29k1HmKwX0U1eDivwHbrr+U=; b=VCr2df8yqu2zVRqOpJTbARGRit m1hfTIschAfZdFGQu4LnvIcIUO3N5p0BFwvwWzKBk3Ly/j3XXlqG7HATwEgY42F+Vg5rtXhntewAq C9BQ+Yc3jOcSzXPjMmnXGoobEDiv/zJHVDzisf6wupdsDXfSn5aCKN6Wd0MO0RTiLb6VIE8TAcJWt FOgklAIb1p/IF5boPz5DC0CWvGQI5rieNHcJA8SON1BvfnOu/rtUXsmqBduX0x2W+L/cUI9WZBRE7 lUjLHF/q31ydFwtmatpKVtOeiUI2sruVWuk9n1XOnpldVDnSpPjrT10wM4brR4ZhyR6YnDLEHN6+g f827VVMA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2b5G-00GMAD-Sr; Sun, 11 Jul 2021 15:09:34 +0000 From: "Matthew Wilcox (Oracle)" To: Jens Axboe Cc: "Matthew Wilcox (Oracle)" , io-uring@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-aio@kvack.org Subject: [PATCH 0/2] Close a hole where IOCB_NOWAIT reads could sleep Date: Sun, 11 Jul 2021 16:09:25 +0100 Message-Id: <20210711150927.3898403-1-willy@infradead.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 0E8FD60019A2 X-Stat-Signature: y47jp395pwe95ywftmei3noh3iia4npa Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=VCr2df8y; spf=none (imf14.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-HE-Tag: 1626016194-84142 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: I noticed a theoretical case where an IOCB_NOWAIT read could sleep: filemap_get_pages filemap_get_read_batch page_cache_sync_readahead page_cache_sync_ra ondemand_readahead do_page_cache_ra page_cache_ra_unbounded gfp_t gfp_mask = readahead_gfp_mask(mapping); memalloc_nofs_save() __page_cache_alloc(gfp_mask); We're in a nofs context, so we're not going to start new IO, but we might wait for writeback to complete. We generally don't want to sleep for IO, particularly not for IO that isn't related to us. Jens, can you run this through your test rig and see if it makes any practical difference? Matthew Wilcox (Oracle) (2): mm/readahead: Add gfp_flags to ractl mm/filemap: Prevent waiting for memory for NOWAIT reads include/linux/pagemap.h | 3 +++ mm/filemap.c | 31 +++++++++++++++++++------------ mm/readahead.c | 16 ++++++++-------- 3 files changed, 30 insertions(+), 20 deletions(-)