Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2313580pxb; Mon, 11 Jan 2021 06:41:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJyp8bEoM4bYSsopXS0dqymi98iPL61eNubywbdYwvNb3v+SQR1olbGcgWizdkMmxGI4ZPGp X-Received: by 2002:aa7:c78c:: with SMTP id n12mr14574564eds.363.1610376099784; Mon, 11 Jan 2021 06:41:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610376099; cv=none; d=google.com; s=arc-20160816; b=zu2i2prHyIBD+F8vHpetfSsxT+vkcGuou+hvW6q1OxO3qtZstw7kze76ZMXGS2HKC4 Q70ALqpY9i4+giy8Tg6xcu0BKWIUbBWol+f8MXSDxrOTwkXZTnPtM2jITHyhST3v61jl 4SL4pklx6M+Sf3pxKw+jVIizxl5ifR5CtZbQSi+vR9Z6BtK1sMG4Gb4COnPR3kixQ/gC QJ3MfUNNFoU1M/VpuDxA6fY4dgk/F7VMe/zYem8qNyLKIkbalf9mIoKe3g5dRGAXHHhC g9wnnb57pT+5MQ0liV8fg3OHS3mO7FfWaaCdY92Yr0tyVUboKEmqHj15T9hAT8wpI4GF mDCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=L13FqP0eG5aQy5rBukrUZk+wm8mWOzuCOQYiz7ff6yg=; b=FP5ycZdwGU2QB29rvT7cHws1yxzRCWFoFChjjyKgCH6IgtegaOIJfPdFHTU5md7vjW t/kCezK3NLtfAphxaC8df63SKAMlhpGyIdIk7D98NeOvdWbF0/S0E4pxuUHezqrSWltG r3vA2Uctau6P1JmuE14jb7MLduBA9YUN0s062H35NknNw5+KC59kYWrbdzs7ZyISQ9o7 Ey0QnMNb4DBjPgZnYpecJUmjBP/vEpRAu0gj0rTnqnifvd9Tab7Au8bz58X/2IOU/mLP NH8OOfbTrUEHb1oqU9shlRAXnKJfchMMG4KpReUh6/zqn4MSjh0FHeFhnBXSTsmNX8RN fa4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r504WNhh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u9si11479edd.26.2021.01.11.06.41.12; Mon, 11 Jan 2021 06:41:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r504WNhh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729788AbhAKOi2 (ORCPT + 99 others); Mon, 11 Jan 2021 09:38:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:41792 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727984AbhAKOi2 (ORCPT ); Mon, 11 Jan 2021 09:38:28 -0500 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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