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=-8.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 E10A2C2D0A3 for ; Sun, 1 Nov 2020 14:55:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3DFCE22242 for ; Sun, 1 Nov 2020 14:55:17 +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="WTdx/tky" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3DFCE22242 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 381346B005C; Sun, 1 Nov 2020 09:55:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 331376B005D; Sun, 1 Nov 2020 09:55:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 221546B0068; Sun, 1 Nov 2020 09:55:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0209.hostedemail.com [216.40.44.209]) by kanga.kvack.org (Postfix) with ESMTP id E17DF6B005C for ; Sun, 1 Nov 2020 09:55:16 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 93A4D8249980 for ; Sun, 1 Nov 2020 14:55:15 +0000 (UTC) X-FDA: 77436147390.25.order11_08051ca272a8 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id 64C3D1804E3A1 for ; Sun, 1 Nov 2020 14:55:15 +0000 (UTC) X-HE-Tag: order11_08051ca272a8 X-Filterd-Recvd-Size: 5750 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Sun, 1 Nov 2020 14:55:14 +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=+okBHoIIs8U5+YrbJBZ2hPierUJPLUOHVl3LY8+9lGI=; b=WTdx/tkymJtaCfMOfFxddjg08W IU0CtGq3pCnV4NPgu219VJKYJO3gQnDFIuOymdEZB1m0eHAPh2zlrSOKxkQE0Bl7cH01o5+BVOkpE 2AFCh1mw8n9vF/eh5/wObchG4QsBDPRnGhA7s6gj3cq/APN1YkcintziZkcG7CmMIJ7ZgFHnEZq7V 6EnYW/Xf2GKJESKnYL7yKuhqJ66qyUm8JWWG0KfA0aOIjweLn0AT2UmKZFWC/V+nPgUrWN5ZXxP2j Z5+Y/dh6+JSYvsDvRkRSamrkVn5wyPRgB/dmpKxb/U1/pQ8kfWkIN9UmsQErBSuDomroYaePOOjTr XQWuTZtw==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZEl9-000793-Qi; Sun, 01 Nov 2020 14:55:08 +0000 Date: Sun, 1 Nov 2020 14:55:07 +0000 From: Matthew Wilcox To: Christoph Hellwig Cc: Andrew Morton , Kent Overstreet , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 04/13] mm: handle readahead in generic_file_buffered_read_pagenotuptodate Message-ID: <20201101145507.GZ27442@casper.infradead.org> References: <20201031090004.452516-1-hch@lst.de> <20201031090004.452516-5-hch@lst.de> <20201031170646.GT27442@casper.infradead.org> <20201101103144.GC26447@lst.de> <20201101104958.GU27442@casper.infradead.org> <20201101105112.GA26860@lst.de> <20201101105158.GA26874@lst.de> <20201101110406.GV27442@casper.infradead.org> <20201101115217.GA27488@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201101115217.GA27488@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 Sun, Nov 01, 2020 at 12:52:17PM +0100, Christoph Hellwig wrote: > On Sun, Nov 01, 2020 at 11:04:06AM +0000, Matthew Wilcox wrote: > > > I'll stop for now. > > > > http://git.infradead.org/users/willy/pagecache.git/shortlog/refs/heads/next > > > > is what i currently have. Haven't pulled in everything from you; certainly not renaming generic_file_buffered_read to filemap_read(), which is awesome. > > i'm about 500 seconds into an xfstests run. > > A bunch of comments from a very quick look: > > mm/filemap: Rename generic_file_buffered_read subfunctions > > - the commit log still mentions the old names Hm? I have this: mm/filemap: Rename generic_file_buffered_read subfunctions The recent split of generic_file_buffered_read() created some very long function names which are hard to distinguish from each other. Rename as follows: generic_file_buffered_read_readpage -> filemap_read_page generic_file_buffered_read_pagenotuptodate -> filemap_update_page generic_file_buffered_read_no_cached_page -> filemap_create_page generic_file_buffered_read_get_pages -> filemap_get_pages > mm/filemap: Change calling convention for buffered read functions > > - please also drop the mapping argument to the various functions while > you're at it Not sure I see the point to it. Sure, they _can_ retrieve it with iocb->ki_filp->f_mapping, but usually we like to pass the mapping argument to functions which do something with the mapping. > mm/filemap: Reduce indentation in gfbr_read_page > > - still mentionds the old function name Fixed. > mm/filemap: Support readpage splitting a page > > - nitpick, I find this a little hard to read: > > + } else if (!trylock_page(page)) { > + put_and_wait_on_page_locked(page, TASK_KILLABLE); > + return NULL; > } > > and would write this a little more coarse as: > > } else { > if (!trylock_page(page)) { > put_and_wait_on_page_locked(page, TASK_KILLABLE); > return NULL; > } > } No strong feeling here. I'll change it. > Also I think the messy list of uptodate checks could now be simplified > down to: > > if (!PageUptodate(page)) { > if (inode->i_blkbits <= PAGE_SHIFT && I've been wondering about this test's usefulness in the presence of THP. Do we want to make it 'if (inode->i_blkbits < (thp_order(page) + PAGE_SHIFT)'? It doesn't make sense to leave it as it is because then a 1kB and 4kB blocksize filesystem will behave differently. > mapping->a_ops->is_partially_uptodate && > !iov_iter_is_pipe(iter)) { > if (!page->mapping) > goto truncated; > if (mapping->a_ops->is_partially_uptodate(page, > pos & (thp_size(page) - 1), count)) > goto uptodate; > } Now that you've rearranged it like this, it's obvious that the truncated check is in the wrong place. We don't want to call filemap_read_page() if the page has been truncated either. > return filemap_read_page(iocb, mapping, page); > } > > mm/filemap: Convert filemap_read_page to return an errno: > > - using a goto label for the put_page + return error case like in my > patch would be cleaner I think A later patch hoists the put_page to the caller, so I think you'll like where it ends up. > mm/filemap: Restructure filemap_get_pages > > - I have to say I still like my little helper here for > the two mapping_get_read_thps calls plus page_cache_sync_readahead I'll take a look at that. Looking at all this again, I think I want to pull the IOCB checks out of filemap_read_page() and just pass a struct file to it. It'll make it more clear that NOIO, NOWAIT and WAITQ can't get to calling ->readpage. I'll send another rev tomorrow.