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.8 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 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 BDAA9C433E0 for ; Sat, 26 Dec 2020 17:57:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 35673217A0 for ; Sat, 26 Dec 2020 17:57:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 35673217A0 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 4787E8D008F; Sat, 26 Dec 2020 12:57:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 427488D0080; Sat, 26 Dec 2020 12:57:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2F0448D008F; Sat, 26 Dec 2020 12:57:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0247.hostedemail.com [216.40.44.247]) by kanga.kvack.org (Postfix) with ESMTP id 1A0438D0080 for ; Sat, 26 Dec 2020 12:57:34 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id CCE8B181AEF0B for ; Sat, 26 Dec 2020 17:57:33 +0000 (UTC) X-FDA: 77636190786.17.blade06_1208ecc27484 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id AEC10180D0180 for ; Sat, 26 Dec 2020 17:57:33 +0000 (UTC) X-HE-Tag: blade06_1208ecc27484 X-Filterd-Recvd-Size: 5244 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Sat, 26 Dec 2020 17:57:33 +0000 (UTC) Received: by mail-lf1-f50.google.com with SMTP id m12so15327966lfo.7 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=HJCqX1NoIaD1nm0AOfYcTExv6zEiuGOzckG9JQUPqPNJfC9BtRrn40DXuuX+7cNa/u /sBfflSVHAZB+oQwlD6whIi3TibOiLJ99Bwwbqwui6wPBMaJXRWgu7i/D6+0/SaWhQtn ghcGDcenqqCNju1KDsAG4LzTv/DrUTp7CYD4nPU2V+gFYsV4SfAkPyOm8CETlpul4men lWomguzNnwHVopuuMMxzaENfHO4nNoj/YCFkFUU7Xe/6NE7abD6gtK+QAy4SjRaMFoLu 6/meaNF6ky75PIZzYr3S+rzCdYjx5ku8XQRiNu/dDsV4x85LmwE3SOv2rlo6oaFopcns ua7A== X-Gm-Message-State: AOAM531yC0wWy/rqpE7C3w7wRoUTqAU3N0AbebupbK+PFcrSoThnoT4Z iWlGKOvG3j/Qf/6hnlH0Dzp7gz7Mv+LarQ== X-Google-Smtp-Source: ABdhPJyBxi+3mg8oTTgjl/P9FPK5GoTtwKmeVaZOBWKLREn5ejyLbWlpqh4pLLnBS0JBZHBfdpdffw== X-Received: by 2002:a2e:a584:: with SMTP id m4mr17629677ljp.247.1609005451242; Sat, 26 Dec 2020 09:57:31 -0800 (PST) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com. [209.85.167.42]) by smtp.gmail.com with ESMTPSA id u8sm5509550ljj.1.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-f42.google.com with SMTP id y19so15215010lfa.13 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" 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 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