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=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 3F7EAC388F2 for ; Tue, 3 Nov 2020 18:55:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9A61A2074B for ; Tue, 3 Nov 2020 18:55:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="fU8/96JT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9A61A2074B 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 006216B0036; Tue, 3 Nov 2020 13:55:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EF8916B005D; Tue, 3 Nov 2020 13:55:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E353C6B0068; Tue, 3 Nov 2020 13:55:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0222.hostedemail.com [216.40.44.222]) by kanga.kvack.org (Postfix) with ESMTP id B7E716B0036 for ; Tue, 3 Nov 2020 13:55:55 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 4713433CD for ; Tue, 3 Nov 2020 18:55:55 +0000 (UTC) X-FDA: 77444011470.22.honey99_560e756272ba Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id 1C95718038E60 for ; Tue, 3 Nov 2020 18:55:55 +0000 (UTC) X-HE-Tag: honey99_560e756272ba X-Filterd-Recvd-Size: 3777 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Tue, 3 Nov 2020 18:55:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=55Rk7l095QACDFFB0DO6Z0QPESjg61svdadMOXv8hNA=; b=fU8/96JTG/VRQhvHHdYnYxcMzn S2GXsDxJuEc0QEs8f0BBkET8bOjdXEdIgt9ghvTJPxpEZKBEObhcqqT2CxDeUrXjy/ubpVzTKMi8Q O1MvM3e42I8liHdvbgO0QfsoBPnN1kVL2D4t9fwjKSkRAsaGCsM18TxP6iLttoW2mWfUNrrCvvd8A Hhgn8M7FiPohPldTaP2DcN/FhFeZMKoArtse4wL5F47izGJdRKRmaad7gv50B6rw4WHjS6IGhzHiO SpHhMgN6oBYLfDXUCBuR+oFb9+7PHUUA4PpYKgpy4DNVy44QEbIK2YvvK24BzdoGHjt7LaImvCipZ p8zE5HUg==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1ka1TA-0005hb-Gx; Tue, 03 Nov 2020 18:55:48 +0000 Date: Tue, 3 Nov 2020 18:55:48 +0000 From: Matthew Wilcox To: Christoph Hellwig Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, kent.overstreet@gmail.com Subject: Re: [PATCH 15/17] mm/filemap: Don't relock the page after calling readpage Message-ID: <20201103185548.GD27442@casper.infradead.org> References: <20201102184312.25926-1-willy@infradead.org> <20201102184312.25926-16-willy@infradead.org> <20201103080045.GN8389@lst.de> <20201103152436.GA27442@casper.infradead.org> <20201103171356.GA18303@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201103171356.GA18303@lst.de> 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: On Tue, Nov 03, 2020 at 06:13:56PM +0100, Christoph Hellwig wrote: > On Tue, Nov 03, 2020 at 03:24:36PM +0000, Matthew Wilcox wrote: > > On Tue, Nov 03, 2020 at 09:00:45AM +0100, Christoph Hellwig wrote: > > > On Mon, Nov 02, 2020 at 06:43:10PM +0000, Matthew Wilcox (Oracle) wrote: > > > > We don't need to get the page lock again; we just need to wait for > > > > the I/O to finish, so use wait_on_page_locked_killable() like the > > > > other callers of ->readpage. > > > > > > As that isn't entirely obvious, what about adding a comment next to > > > the wait_on_page_locked_killable call to document it? > > > > The other callers of ->readpage don't document that, so not sure why > > we should here? > > The callers of ->readpage are a mess :( > > Many use lock_page or trylock_page, one uses wait_on_page_locked directly, > another one uses the wait_on_page_read helper. I think we need a good > helper here, and I think it looks a lot like filemap_read_page in your > tree.. Oh, heh. Turns out I wrote this in a patch series the other day ... static int mapping_readpage(struct file *file, struct address_space *mapping, struct page *page, bool synchronous) { struct readahead_control ractl = { .file = file, .mapping = mapping, ._index = page->index, ._nr_pages = 1, }; int ret; if (!synchronous && mapping->a_ops->readahead) { mapping->a_ops->readahead(&ractl); return 0; } ret = mapping->a_ops->readpage(file, page); if (ret != AOP_UPDATED_PAGE) return ret; unlock_page(page); return 0; } (it's for swap_readpage, which is generally called in an async manner ... and really doesn't handle errors at all well) This does illustrate that we need the mapping argument. Some of the callers of ->readpage need to pass a NULL file pointer, so we can't get it from file->f_mapping.