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=-5.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_RED 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 817D0C433DB for ; Mon, 28 Dec 2020 21:59:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DEABA22242 for ; Mon, 28 Dec 2020 21:59:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DEABA22242 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F30058D001E; Mon, 28 Dec 2020 16:59:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EE06A8D0018; Mon, 28 Dec 2020 16:59:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DA7788D001E; Mon, 28 Dec 2020 16:59:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0040.hostedemail.com [216.40.44.40]) by kanga.kvack.org (Postfix) with ESMTP id C0EB98D0018 for ; Mon, 28 Dec 2020 16:59:02 -0500 (EST) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 814BE3629 for ; Mon, 28 Dec 2020 21:59:02 +0000 (UTC) X-FDA: 77644056924.21.clock51_3b05f9b27497 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id 65D39180442C0 for ; Mon, 28 Dec 2020 21:59:02 +0000 (UTC) X-HE-Tag: clock51_3b05f9b27497 X-Filterd-Recvd-Size: 5304 Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by imf10.hostedemail.com (Postfix) with ESMTP for ; Mon, 28 Dec 2020 21:59:01 +0000 (UTC) Received: by mail-lf1-f52.google.com with SMTP id y19so26742703lfa.13 for ; Mon, 28 Dec 2020 13:59:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=l7m3SnG2byIKSUnU3LGhGJnX6zTtZd1eKGo8z5V3mzE=; b=fiM1q+0IVYY4uj9MX58uHfv2pJalKxWjDggR7FEvNQSJyBIr2SF36vF8wH1Ott4CES No9E+aMy4aJrRCDTJ9cTE1AZibFDvDrjGOVocfK03fYD/Ii98ezl6YtZa8g0fLXCMmDt 2OPi5rPnE2CtS9NbOFJWyfUiC2vPte3YO9gDc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=l7m3SnG2byIKSUnU3LGhGJnX6zTtZd1eKGo8z5V3mzE=; b=kv00rX+gGPtoIY7RbETWHWdTJq6a7pU3tjE99+6k+M669j0KLfeN/EsaP27RvVTm2o ShLjaY46FDLOYfzJAUzSo4qla0ATCTmFa8QqmLHSHKxMlL7PKeiDIwXh/RJWiyh7ac/M Axj/wPIsEcx2RuaTV28Mdov2m52D9vp48faDRPCejHMwNoCwQ0kqY4hYaiL+afrB0ZIh 4zeqn9RZFVbh31aEOLCXNW1RwU52Aq/Dp8X0o6CXqKAODKtCVcq/jBSEbIoM8vffUI5u Rn4ofOujMKjQ3471GBkHk80zu+YomvilCb8aZzxBXMBcBSWxlJNxR+Vs/DHwaXifBtLg etfA== X-Gm-Message-State: AOAM531CZKl8MoxIv2zSAj0wgKWG/QLTGQ59Jmg5eQk/rhRWVffDl+ng NeLm+oTLcndaucJ15lDxiwaaJCqDpvQ8rQ== X-Google-Smtp-Source: ABdhPJzotm9qrFJQ48smTmEqsKw3wfMQlbB+E8uo+72ukpByG9gsxMu/W5pr9S5pm+dLrCE8bQ012w== X-Received: by 2002:a2e:760c:: with SMTP id r12mr22013378ljc.11.1609192739696; Mon, 28 Dec 2020 13:58:59 -0800 (PST) Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com. [209.85.167.45]) by smtp.gmail.com with ESMTPSA id 76sm5422822lfh.163.2020.12.28.13.58.57 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Dec 2020 13:58:57 -0800 (PST) Received: by mail-lf1-f45.google.com with SMTP id m12so26872837lfo.7 for ; Mon, 28 Dec 2020 13:58:57 -0800 (PST) X-Received: by 2002:a19:7d85:: with SMTP id y127mr20651667lfc.253.1609192736859; Mon, 28 Dec 2020 13:58:56 -0800 (PST) MIME-Version: 1.0 References: <20201226204335.dikqkrkezqet6oqf@box> <20201226224016.dxjmordcfj75xgte@box> <20201227234853.5mjyxcybucts3kbq@box> <20201228125352.phnj2x2ci3kwfld5@box> In-Reply-To: From: Linus Torvalds Date: Mon, 28 Dec 2020 13:58:40 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] mm: Allow architectures to request 'old' entries when prefaulting To: "Kirill A. Shutemov" Cc: Hugh Dickins , Matthew Wilcox , "Kirill A. Shutemov" , Will Deacon , Linux Kernel Mailing List , Linux-MM , Linux ARM , Catalin Marinas , Jan Kara , Minchan Kim , Andrew Morton , Vinayak Menon , Android Kernel Team Content-Type: text/plain; charset="UTF-8" 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, Dec 28, 2020 at 10:47 AM Linus Torvalds wrote: > > I personally think it's wrong to update vmf->pte at all. We should > just have a local 'ptep' pointer that we update as we walk along. But > that requires another change to the calling convention, namely to > "do_set_pte()". Actually, I think we should not use do_set_pte() at all. About half of do_set_pte() is about the FAULT_FLAG_WRITE case, which the fault-around code never has set (and would be wrong if it did). So I think do_set_pte() should be made local to mm/memory.c, and the filemap_map_pages() code should do it's own simplified version that just does the non-writable case, and that just gets passed the address and the pte pointer. At that point, there would no longer be any need to update the address/pte fields in the vmf struct, and in fact I think it could be made a "const" pointer in this cal chain. This is all just from looking at the code, I haven't tried to write a patch to do this, so I might be missing some case. Linus