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=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 6A7A6C433E6 for ; Mon, 11 Jan 2021 14:37:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 053EE225AB for ; Mon, 11 Jan 2021 14:37:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 053EE225AB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 202C28D0035; Mon, 11 Jan 2021 09:37:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1B1FE8D0020; Mon, 11 Jan 2021 09:37:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 07B0F8D0035; Mon, 11 Jan 2021 09:37:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0151.hostedemail.com [216.40.44.151]) by kanga.kvack.org (Postfix) with ESMTP id E75A98D0020 for ; Mon, 11 Jan 2021 09:37:49 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id B3D721DF6 for ; Mon, 11 Jan 2021 14:37:49 +0000 (UTC) X-FDA: 77693748258.20.wound01_021601f2750d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id 8C516180C07A3 for ; Mon, 11 Jan 2021 14:37:49 +0000 (UTC) X-HE-Tag: wound01_021601f2750d X-Filterd-Recvd-Size: 2974 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Mon, 11 Jan 2021 14:37:49 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id D905E2255F; Mon, 11 Jan 2021 14:37:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1610375868; bh=GWRS5isknuBePcoSAEiQ0Gy97LT1eGijAvL9gElMOKg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=r504WNhhXsmdMwwackGhLo169jGkVCjkosfE9M0sCA0ZYCTMnJILVvIQbIESp1eWw pheYCRuPCnBSGC9dYMVYt2RxAS//hrSZxls78sajMqIhrA9rrRHL3ffErTIWhP6Yky XXtQSUy9D2V9NpydrbhpZKLbdjtcM4p5z3I+pu7Rv5zcz9S/XPms9+7i816uP1mXLN N0jRUfMInp84kiybxt1UYP5xetN7fRLythVa4Y82fhV7RK/EKZDMGrHjW4ceV6WSwj t5v2MOCcLEImMD6QAljKq5yOWkit6zp55i4vwV/iV3WoYiQeXRzyFy0Mvdlu+c5R0v LgfQfu9skWxPA== Date: Mon, 11 Jan 2021 14:37:42 +0000 From: Will Deacon To: "Kirill A. Shutemov" Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, Catalin Marinas , Jan Kara , Minchan Kim , Andrew Morton , "Kirill A . Shutemov" , Linus Torvalds , Vinayak Menon , Hugh Dickins , kernel-team@android.com Subject: Re: [PATCH v2 2/3] mm: Allow architectures to request 'old' entries when prefaulting Message-ID: <20210111143742.GD7642@willie-the-truck> References: <20210108171517.5290-1-will@kernel.org> <20210108171517.5290-3-will@kernel.org> <20210111142533.oulduqd76mkpdkst@box> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210111142533.oulduqd76mkpdkst@box> User-Agent: Mutt/1.10.1 (2018-07-13) 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 Mon, Jan 11, 2021 at 05:25:33PM +0300, Kirill A. Shutemov wrote: > On Fri, Jan 08, 2021 at 05:15:16PM +0000, Will Deacon wrote: > > diff --git a/mm/filemap.c b/mm/filemap.c > > index c1f2dc89b8a7..0fb9d1714797 100644 > > --- a/mm/filemap.c > > +++ b/mm/filemap.c > > @@ -3051,14 +3051,18 @@ vm_fault_t filemap_map_pages(struct vm_fault *vmf, > > if (!pte_none(*vmf->pte)) > > goto unlock; > > > > + /* We're about to handle the fault */ > > + if (vmf->address == address) { > > + vmf->flags &= ~FAULT_FLAG_PREFAULT; > > + ret = VM_FAULT_NOPAGE; > > + } else { > > + vmf->flags |= FAULT_FLAG_PREFAULT; > > + } > > + > > Do we need to restore the oririnal status of the bit once we are done? I can certainly add that, although it doesn't look like we do that for vmf->pte, so it's hard to tell what the rules are here. It certainly feels odd to restore some fields but not others, as it looks like vmf->address will be out-of-whack with vmf->pte when filemap_map_pages() returns. Am I missing something? Will