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=-9.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,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 6F4C0C388F7 for ; Sat, 31 Oct 2020 17:06:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8A2CC206B5 for ; Sat, 31 Oct 2020 17:06:53 +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="HeVU4Lwz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8A2CC206B5 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 885236B0036; Sat, 31 Oct 2020 13:06:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 834F36B005C; Sat, 31 Oct 2020 13:06:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 724CF6B005D; Sat, 31 Oct 2020 13:06:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0077.hostedemail.com [216.40.44.77]) by kanga.kvack.org (Postfix) with ESMTP id 46F376B0036 for ; Sat, 31 Oct 2020 13:06:52 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id D7D98180AD802 for ; Sat, 31 Oct 2020 17:06:51 +0000 (UTC) X-FDA: 77432850222.30.grass17_4e00cf2272a0 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id BA48C180B3AA7 for ; Sat, 31 Oct 2020 17:06:51 +0000 (UTC) X-HE-Tag: grass17_4e00cf2272a0 X-Filterd-Recvd-Size: 3698 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf31.hostedemail.com (Postfix) with ESMTP for ; Sat, 31 Oct 2020 17:06:51 +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=2fuF80OZc+gvx2mAEagME1x9EKItLKMm/B5VZr0kCEU=; b=HeVU4LwzdFE3OR8gO6KSDQhY/c CS3iW+pzUJRP8DiiOc/xvmCnB5lWh2rVaWVXSv+jvIR7HVGkxj74mVMG+qs0icUQHxMX8hicjULdc 3EX3wGUZ3Ortu/eLUmezSWF/UokGP8EERdG0JLDEBBEsIUH2NPGVvw8R8RmdriGxgHbmF/IiyFGOa bu5WJr2IHOL7VT1vbPlmWuvX3wPdtqssaxDbYSuXdIi8giQTJozOmg9yUUm4qJqNkvSoMqs6z5y8j 6zPFxVVxeoXqnNpuVD/m8gsEgxTYl4AG9u1i5llrTYQxzHvgBvd82t5PadLq5JO1kHBUh6sIpwcIU VJZHxqnA==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYuL0-00005G-9a; Sat, 31 Oct 2020 17:06:46 +0000 Date: Sat, 31 Oct 2020 17:06:46 +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: <20201031170646.GT27442@casper.infradead.org> References: <20201031090004.452516-1-hch@lst.de> <20201031090004.452516-5-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201031090004.452516-5-hch@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 Sat, Oct 31, 2020 at 09:59:55AM +0100, Christoph Hellwig wrote: > Move the calculation of the per-page variables and the readahead handling > from the only caller into generic_file_buffered_read_pagenotuptodate, > which now becomes a routine to handle everything related to bringing > one page uptodate and thus is renamed to filemap_read_one_page. > > Signed-off-by: Christoph Hellwig > --- > mm/filemap.c | 63 +++++++++++++++++++++++----------------------------- > 1 file changed, 28 insertions(+), 35 deletions(-) > > diff --git a/mm/filemap.c b/mm/filemap.c > index bae5b905aa7bdc..5cdf8090d4e12c 100644 > --- a/mm/filemap.c > +++ b/mm/filemap.c > @@ -2217,13 +2217,26 @@ static int filemap_readpage(struct kiocb *iocb, struct page *page) > return error; > } > > -static int generic_file_buffered_read_pagenotuptodate(struct kiocb *iocb, > - struct iov_iter *iter, struct page *page, loff_t pos, > - loff_t count, bool first) > +static int filemap_make_page_uptodate(struct kiocb *iocb, struct iov_iter *iter, > + struct page *page, pgoff_t pg_index, bool first) I prefer "filemap_update_page". I don't understand why you pass in pg_index instead of using page->index. We dereferenced the page pointer already to check PageReadahead(), so there's no performance issue here. Also, if filemap_find_get_pages() stops on the first !Uptodate or Readahead page, as I had it in my patchset, then we don't need the loop at all -- filemap_read_pages() looks like: nr_pages = filemap_find_get_pages(iocb, iter, pages, nr); if (!nr_pages) { pages[0] = filemap_create_page(iocb, iter); if (!IS_ERR_OR_NULL(pages[0])) return 1; if (!pages[0]) goto retry; return PTR_ERR(pages[0]); } page = pages[nr_pages - 1]; if (PageUptodate(page) && !PageReadahead(page)) return nr_pages; err = filemap_update_page(iocb, iter, page); if (!err) return nr_pages; nr_pages -= 1; if (nr_pages) return nr_pages; return err;