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 A094FC4361B for ; Fri, 18 Dec 2020 18:58:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4C61423B85 for ; Fri, 18 Dec 2020 18:58:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726551AbgLRS55 (ORCPT ); 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-Google-Smtp-Source: ABdhPJwRY7y2mKS8fkcTfwciIX1wxR4IYi1T3XEpCA9rsbWJ05dyMJSkMpu8PtQfvFLwzwtfwEqQBQ== 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