Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2418636pxu; Fri, 18 Dec 2020 12:48:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJzL+UaY3rW1Ia6XJRaR3LDTR0Gk60gv8W+MbBgXtbA4YJSiWeCIHDTrmgscQQUwv45JwP1C X-Received: by 2002:a17:906:af79:: with SMTP id os25mr5807534ejb.275.1608324483487; Fri, 18 Dec 2020 12:48:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608324483; cv=none; d=google.com; s=arc-20160816; b=mukpNrGE+/UuB8gSbh2yu3tRhXCp8ANy5j7y8wHOrOQoM2Tyx30v4w7mSzhoUfgWCv 6h1YEX4naY4rW5SxD7PUc+GvkcU1olEW0PJsYv9ihXZs2dpaExdsUHpjA8bnxyecD0Pu B4BCZPr7pd8QxADnkqN58LDU+Da26wdElUHWJgtB8tXu2NtIXKgusqD3yQtcc0roUCru 1mqi6t9JwivlX01HTCYOyRH2H9cyfbhhgMw4mYB2yIa20m/FKw2z3pycOrb0ypQrhOdQ 45UMH6oyXJXQ0pwFMvrf1Ku6P41bgr5HkME7SgxFWvrEoKtGkj18XjWiNXOj5VgVNBTq nAsg== 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=uTkIwRPG9MysKSy4nLERH4DSVmgkNBJHlqN1//PDmMg=; b=xJvNfNwtrDBx690OMM6RPG4IL0E4u5bJx0CEhjT4tPv6p9jjEC+pALNdBbkD99JGBw sKk+xKTEgqUsWGmTsm8h0zoMSB/WX9mPHaSBvpoRu9tsmuS22/xAdvoODutvxQlg+0Jw QtWeBFFE33hxxm1SgVvZgW6MMh4QoruwFBbAsAxBWvcE8BY1jyHRqh47Ggv2m606QjRh 7PhuhRg2wrn3hLCMj+gArl9N/1jcWmNexJ1BjTTrjEEN8sq/MTQIFqbHvR6qzH3Q+2ug sVIFlhVGOLKty46OhsDS9cF9QXs7GqTgBlUpQwN1Z/zyLrQhhS03Ox1saFYRon+0ckuq 66kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=dsF5q71E; 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 lz11si5296584ejb.341.2020.12.18.12.47.40; Fri, 18 Dec 2020 12:48:03 -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=dsF5q71E; 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 S1725871AbgLRS55 (ORCPT + 99 others); Fri, 18 Dec 2020 13:57:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725804AbgLRS54 (ORCPT ); Fri, 18 Dec 2020 13:57:56 -0500 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F508C0617A7 for ; Fri, 18 Dec 2020 10:57:16 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id h205so8015207lfd.5 for ; Fri, 18 Dec 2020 10:57:16 -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=uTkIwRPG9MysKSy4nLERH4DSVmgkNBJHlqN1//PDmMg=; b=dsF5q71ELOhRK7vGOEP6lscSDyihytaDJgLbWaXR+ZI6DYKPA+mGbTu53U5ZoRC/DL 1+pKhVd1B9xa8VF/IukiJOfVgOnuGio7+tX2NCp8romWhqh1y5rH2y2WQZkVKJAPYmgl Lvat0PcrqQdD0PeMMR7ynUxZiG5BSUcGfefI0= 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=uTkIwRPG9MysKSy4nLERH4DSVmgkNBJHlqN1//PDmMg=; b=A8UgK8TSl92XiMFKUFXH1YuNZQWXjK5Kk4+QiXxrADU9CtR3AX82tLGcXw+Z4sfuh+ k39HsWO6w/rCHHj3znGa9JTDJQdS17aqKDv6GUmUpcIhnshNJ8BM+/qzpxYpO0Z5R5Lj hSZuYelx2JEGSF7LL1/zTyjKKO4FL28YhiMGj0MhxFPFdtUUbfx+M8qiKng/tCa1YzAq j5CVpT8E6uqXeRwpbighWLwLO5/N8wW42kBeje7cGMeTbmzs3UWHwHFH0cc4je4APGR5 IN6R/YTAtRErg9V2PbXCcdg7LOUMgauiuGIdduJ+yoHwBcVYCwvQfMBZ6LekSvH85u2+ qL6g== X-Gm-Message-State: AOAM532bg1qsr9I6pl2iyRYJV7UtuwFvUcSBwZbr+IUF1GCTQDJ9Z+40 loFmFwJVlrq5A/VlNC7c1NxSgmLhCb+VMA== X-Received: by 2002:a19:2d10:: with SMTP id k16mr1884264lfj.161.1608317834320; Fri, 18 Dec 2020 10:57:14 -0800 (PST) Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com. [209.85.167.49]) by smtp.gmail.com with ESMTPSA id m7sm1011385lfb.146.2020.12.18.10.57.11 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 18 Dec 2020 10:57:12 -0800 (PST) Received: by mail-lf1-f49.google.com with SMTP id m25so7931459lfc.11 for ; Fri, 18 Dec 2020 10:57:11 -0800 (PST) X-Received: by 2002:a2e:9b13:: with SMTP id u19mr2332467lji.48.1608317831659; Fri, 18 Dec 2020 10:57:11 -0800 (PST) MIME-Version: 1.0 References: <20201209184049.GA8778@willie-the-truck> <20201210150828.4b7pg5lx666r7l2u@black.fi.intel.com> <20201214160724.ewhjqoi32chheone@box> <20201216170703.o5lpsnjfmoj7f3ml@box> <20201217105409.2gacwgg7rco2ft3m@box> <20201218110400.yve45r3zsv7qgfa3@box> In-Reply-To: <20201218110400.yve45r3zsv7qgfa3@box> From: Linus Torvalds Date: Fri, 18 Dec 2020 10:56:55 -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: 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 18, 2020 at 3:04 AM Kirill A. Shutemov wrote: > > This should do. See below. Looks fine. > > Then that second loop very naturally becomes a "do { } while ()" one. > > I don't see it. I haven't found a reasonable way to rework it do-while. Now that you return early for the "HEAD == NULL" case, this loop: for (; head; head = xas_next_entry(&xas, end_pgoff)) { [...] } very naturally becomes do { [...] } while ((head = xas_next_entry(&xas, end_pgoff)) != NULL); because the initial test for 'head' being NULL is no longer needed, and thus it's a lot more logical to just test it at the end of the loop when we update it. No? Maybe I'm missing something silly. Linus