Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp7945137pxu; Sat, 26 Dec 2020 09:59:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJzajil/dlEaG0I8B+w66zaauEdg3ZAQlEaULziF7Q0ZN0JybfHyLhbZf8H+LogfE6fKE6vZ X-Received: by 2002:a17:907:6e9:: with SMTP id yh9mr35498027ejb.131.1609005545221; Sat, 26 Dec 2020 09:59:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609005545; cv=none; d=google.com; s=arc-20160816; b=ut1Apel0Z97CMM7U927HMVjutYPenUkIghtS5Lqkbbnw7O8Q4Sab17ZA2IiitxJEqq YqH5FnqiRAE/Oj+P/4Eil5EgQxRuLlapY48/8N/U+pT+qZD8qtVH1arUkF+enZrewXJH KELd+oJQvXYQIgI6sJtF/UnAXCs3PYzJphWav+0t+xrg5dSiC5myO3UteBiXbgo7827q 5I/PVQvKtVUHBnEb3tX1+Zqb2bEqL3p+XWM6ryK6pL7uwWKCcirwPJJfmzhAF/FEPSgx Ye9v0K1xu0d3EQG2oyTuLzZNzd6AfdPH1Fp1DRAEJJM+93Yxc+Vzryv62BKy9vUavDbX kASw== 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=vB3TbcX+phhLHqNLVTnsPQIuYLV410SZ/S3x77H/Azk=; b=R0QcjApTt6bl/SkaAA/6dY1EadIC0G+YuJusspwtLp8YlZX6HimD2MTeI8eC15cMnA 3zGy2ss7rMtS6ki+/1FsedFnzJIS05ZQofN2IfwVC7OdmehvVEWSc/yeer/1TeW6obB6 ZwGVnXnHKi0UKmQ884s1yPAQOm2pce6fPvXIupvukTuhISPi1JPQbHFH5Kri2J2CpigC usbHo4aA4jN17rraCMBw9WTFjyGaWVBTFs9wO+PZZ7WAXFGKA5QD8KDXO5KYNIZPW4AP FZjzdfC/TmOk63ksskUk1hyrUEa/aMsETukeQbOWKiV0gBnutRosUJ5buyW8kuP1cwwH IKzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=JiLZpPHD; 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 j24si17735846edt.448.2020.12.26.09.58.41; Sat, 26 Dec 2020 09:59:05 -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=JiLZpPHD; 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 S1726289AbgLZR6O (ORCPT + 99 others); Sat, 26 Dec 2020 12:58:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726194AbgLZR6N (ORCPT ); Sat, 26 Dec 2020 12:58:13 -0500 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C73CC061757 for ; Sat, 26 Dec 2020 09:57:33 -0800 (PST) Received: by mail-lf1-x12e.google.com with SMTP id s26so15308698lfc.8 for ; Sat, 26 Dec 2020 09:57:33 -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=vB3TbcX+phhLHqNLVTnsPQIuYLV410SZ/S3x77H/Azk=; b=JiLZpPHDeFio2xKaqd4AF6b+AaACUv2JAlVW2TC/2qFFp6T2XByLfEVcoTR8ni+2ir VahaBF7tUkyt0AUQJGX/7pPCiMG9x70Kxcco01Hh4iOJRmaJRmVWUdq7UwxeDmLQofJc n0wyg+xmy7/jzNvOpKECnfI8lHqRJ9kujirOU= 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=vB3TbcX+phhLHqNLVTnsPQIuYLV410SZ/S3x77H/Azk=; b=Ku0vXFHDAQwldzO+Tm9HvpgJG4mQr/y+Swx9wSNqwfK6QLVCXm7AZHHaQiN4jthGS0 jpfFEPNHSEIudy3c/lr+u+I/kDCszV52ues4kXRPYrcR++XlQWvP5mKcnrIohESno4RF 7vxK6BQELgdkG8FThzZSq/0TiHxclOC969BxLHgljj8MBQk2OPAodGZpJGAelyB7gMJd ao/2DM5K0o2LAGdYz6pHbEL4S4DUJFsZO3qA1bmfbPn7BTA9pBhdgUHgzo0I7XPCoSgP kWi1HpRj+EaRDywkDbkdaAYwg9ycX3Dr1cAXxdJn6I96Crf4nhS2QvGOFwDsa0GjTC3q zj6Q== X-Gm-Message-State: AOAM533KR002kG3cK7hfPS7oxMJaz532cncK5fLt3GXkgrY3fTST8R+N 9vBQfuNoSqHDDorhx42iAlBTNSTAqF0fZQ== X-Received: by 2002:a2e:98d1:: with SMTP id s17mr13850890ljj.308.1609005451392; Sat, 26 Dec 2020 09:57:31 -0800 (PST) Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com. [209.85.167.44]) by smtp.gmail.com with ESMTPSA id v6sm4731316lfa.200.2020.12.26.09.57.29 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 26 Dec 2020 09:57:29 -0800 (PST) Received: by mail-lf1-f44.google.com with SMTP id x20so15265339lfe.12 for ; Sat, 26 Dec 2020 09:57:29 -0800 (PST) X-Received: by 2002:a05:6512:789:: with SMTP id x9mr15301778lfr.487.1609005449200; Sat, 26 Dec 2020 09:57:29 -0800 (PST) MIME-Version: 1.0 References: <20201216170703.o5lpsnjfmoj7f3ml@box> <20201217105409.2gacwgg7rco2ft3m@box> <20201218110400.yve45r3zsv7qgfa3@box> <20201219124103.w6isern3ywc7xbur@box> <20201222100047.p5zdb4ghagncq2oe@box> <20201225113157.e7hmluffh56fszfc@box> In-Reply-To: <20201225113157.e7hmluffh56fszfc@box> From: Linus Torvalds Date: Sat, 26 Dec 2020 09:57:13 -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 Fri, Dec 25, 2020 at 3:31 AM Kirill A. Shutemov wrote: > > The new helper next_page() returns a stablized page, so filemap_map_pmd() > can clearly decide if we should set up a page table or a huge page. I really like that next_page() abstraction, my only comment is that I think it should be renamed as "next_stable_page()" or something, and then this part: + if (!page) + page = xas_find(xas, end_pgoff); + else + page = xas_next_entry(xas, end_pgoff); should be in the caller. Then just have two helper functions like 'first_map_page()' and 'next_map_page()' which just do next_stable_page(xas_find(xas, end_pgoff)) and next_stable_page(xas_next_entry(xas, end_pgoff)) respectively. Because not only does that get rid of the "if (page)" test, I think it would make things a bit clearer. When I read the patch first, the initial "next_page()" call confused me. But maybe I'm just grasping at straws. Even in this format, I think it's a nice cleanup and makes for more understandable code. Linus