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.6 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 78751C433DF for ; Wed, 14 Oct 2020 17:35:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C428B221EB for ; Wed, 14 Oct 2020 17:35:07 +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="e/CJ+gzF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C428B221EB 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 028BC6B006E; Wed, 14 Oct 2020 13:35:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F1A5A6B0070; Wed, 14 Oct 2020 13:35:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E2ED46B0071; Wed, 14 Oct 2020 13:35:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0076.hostedemail.com [216.40.44.76]) by kanga.kvack.org (Postfix) with ESMTP id B6B126B006E for ; Wed, 14 Oct 2020 13:35:06 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 31DCD3625 for ; Wed, 14 Oct 2020 17:35:04 +0000 (UTC) X-FDA: 77371231728.02.cloud67_0d11f632720d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id 04D9310226C15 for ; Wed, 14 Oct 2020 17:35:03 +0000 (UTC) X-HE-Tag: cloud67_0d11f632720d X-Filterd-Recvd-Size: 3808 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Wed, 14 Oct 2020 17:35:03 +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=bFmp8qmgBGhqB/X65ibwSq7YXKtNnPqEkqnUE5CNjEo=; b=e/CJ+gzF8JKH8KtYyrNxYuOSkV B454oRZUzlRVyVXJUQWRlJTYtsR8r3hhJHGjfJN1Lci0RKBHG3yxMXwjZPIX+jHCUNpTVTa+J4jKW AkKR2toT/nv9lv9ZZT72RmzL2+NPZssaoNRObRc42/aRDwc35u6GvkHpZz0UITqGWF2BFMtla+uyx W0BtjjcG8eKeWpDjO6YcChWX2QBThekM5dGa10yQc+bI0l3wY0fRiLiYACT/Zee565bhjAAAJjag/ H4p3LeTHLebyk99pmv+4UHsysvX3qjsql3DqWx9Lfhyb2ymaQhT5z0SrRobDc/Qd8ZHrDQO5iOmiH autXjUeQ==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kSkg0-0005Gv-8n; Wed, 14 Oct 2020 17:35:00 +0000 Date: Wed, 14 Oct 2020 18:35:00 +0100 From: Matthew Wilcox To: "Darrick J. Wong" Cc: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 07/14] iomap: Support THPs in readpage Message-ID: <20201014173500.GR20115@casper.infradead.org> References: <20201014030357.21898-1-willy@infradead.org> <20201014030357.21898-8-willy@infradead.org> <20201014163936.GJ9832@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201014163936.GJ9832@magnolia> 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 Wed, Oct 14, 2020 at 09:39:36AM -0700, Darrick J. Wong wrote: > On Wed, Oct 14, 2020 at 04:03:50AM +0100, Matthew Wilcox (Oracle) wrote: > > +/* > > + * The page that was passed in has become Uptodate. This may be due to > > + * the storage being synchronous or due to a page split finding the page > > + * is actually uptodate. The page is still locked. > > + * Lift this into the VFS at some point. > > + */ > > +#define AOP_UPDATED_PAGE (AOP_TRUNCATED_PAGE + 1) > > Er... why not lift it now? > > "Because touching fs.h causes the whole kernel to be rebuilt and that's > annoying"? :D Hah! Because I already have a patch series out that does lift it to the VFS: https://lore.kernel.org/linux-fsdevel/20201009143104.22673-1-willy@infradead.org/ which I'm kind of hoping gets merged first. Then I can adjust this patch. > > +static int iomap_split_page(struct inode *inode, struct page *page) > > +{ > > + struct page *head = thp_head(page); > > + bool uptodate = iomap_range_uptodate(inode, head, > > + (page - head) * PAGE_SIZE, PAGE_SIZE); > > + > > + iomap_page_release(head); > > + if (split_huge_page(page) < 0) { > > + unlock_page(page); > > + return AOP_TRUNCATED_PAGE; > > + } > > + if (!uptodate) > > + return 0; > > + SetPageUptodate(page); > > + return AOP_UPDATED_PAGE; > > +} > > + > > int > > iomap_readpage(struct page *page, const struct iomap_ops *ops) > > { > > struct iomap_readpage_ctx ctx = { .cur_page = page }; > > - struct inode *inode = page->mapping->host; > > + struct inode *inode = thp_head(page)->mapping->host; > > unsigned poff; > > loff_t ret; > > > > - trace_iomap_readpage(page->mapping->host, 1); > > + trace_iomap_readpage(inode, 1); > > + > > + if (PageTransCompound(page)) { > > + int status = iomap_split_page(inode, page); > > + if (status == AOP_UPDATED_PAGE) { > > + unlock_page(page); > > /me wonders why not do the unlock in iomap_split_page? This is working around AOP_UPDATED_PAGE not existing in the VFS. So adjusting this patch becomes: int status = iomap_split_page(inode, page); if (status) return status;