Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9465701pxu; Mon, 28 Dec 2020 17:32:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJwpkLrMzoEEnXSMFZZRGdF1D7rjaKtt3MPOqTLYNZEuPyLV/Onnvgbpb4bQXSnXvNIgS37r X-Received: by 2002:a05:6402:318f:: with SMTP id di15mr44512582edb.237.1609205554716; Mon, 28 Dec 2020 17:32:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609205554; cv=none; d=google.com; s=arc-20160816; b=Dw+YFZjTNVJfh5BmqjiwlG2wOstkiGXPkfl/hA081LQIFYIX/Cte89lNwhyQGtm5qv sYZ+v1cSPDurgrYm6G2L0u+wKkaVJ3LEMpIe57yebLZfwvNsViY7ROVTQCxTQn8jtoXK sbVeFPyuUQeNatMSkUTM3afL9I/TTAC3Ewn13FCEJt4FjPwB0STupwxutqgeVK5fi/oI 2Rul8RDe5GWvwtOfg3L19Ve9cMhI9jlsxkxLgQEiF6BdEdtDO2wHoFwSoles5OXV9TK8 YIJoryCdVcc4tS+zlLo+Wiwnd2GNXuJXMEdyR2wvd5sgn+hDbRVBG29b6FC0tS8C/oCq nRHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=l7m3SnG2byIKSUnU3LGhGJnX6zTtZd1eKGo8z5V3mzE=; b=USW1NoVf1VRQpBGAzdA2v8ciP5fXl6NXxMkhhsqZp6/+HGHPMQqtGoczi+o4R74LGx Qv71q9oQmND0JQVwm5J5zkm0SYOopr9cNacDyoFlB6S6JjprG4MEQLGPLJfwT65gBZdR lT8slACE7l1vOq/gVrZVNrYaBbnvu+NcjnyPbr76VhOTTtsbsd2Ph6gfzP0m5tuQgBsq RkzifUNgjLja1O5zstShb5WfwSxa+V71Z5VYZ28zMi+1Q8A3c8e0PNz70XPfZ4DCY4DQ 63VqeagZIjXUEqV8OCb0+z9PUNCIR2vnRvi1y4mXVDzAAnwOXvFtfBct+9UTbKKVpD2I mFrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=fiM1q+0I; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 97si21199044edr.29.2020.12.28.17.32.12; Mon, 28 Dec 2020 17:32:34 -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=@linux-foundation.org header.s=google header.b=fiM1q+0I; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731893AbgL1W4Y (ORCPT + 99 others); Mon, 28 Dec 2020 17:56:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729596AbgL1V7n (ORCPT ); Mon, 28 Dec 2020 16:59:43 -0500 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3142DC0613D6 for ; Mon, 28 Dec 2020 13:59:03 -0800 (PST) Received: by mail-lf1-x130.google.com with SMTP id s26so26852217lfc.8 for ; Mon, 28 Dec 2020 13:59:03 -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=AzuGUduSNWyVg8TRwnHP9q0DMWmYj551wKNEhEznKXGv5ACRMRJqtuq8g2e071ynVO qUEfM4Ohp3tXfXPvAaUx/oCd4RDqFrCQw58L1fmdtkTr5bUyrnGPpWxjig0iAqiAaYsN rqIxrY3lISADPGmC2+Xz66PIOf0MDYteZUBXGfkBHGDclify7bOZSNc4FWIoX+g6hVQ5 J/+jAt77Khwi/GIZV5WxsDIPWX1T6LiRvJp+3lKK+hVPD3q0wzT/6kP7/+lyJgU2Z+p6 HDXlgNIQ9dbdFTJJCOxqM8jrxpIGKOmkAZOciypi1NivGi6mK0mJVqYvizgFMaFVULZa f0Yg== X-Gm-Message-State: AOAM532eoriOblQv2YEgXTn544j/Hgj12nRs4xIxvaKdFxQpVVT/SqVW Pjy96w3mm3HmGSB9N4m4tZ11+/y3MZY62Q== X-Received: by 2002:a05:6512:33b5:: with SMTP id i21mr20739020lfg.228.1609192739984; 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 e2sm6640251ljp.75.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 b26so26857509lff.9 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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