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,URIBL_BLOCKED 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 C9E66C4361B for ; Fri, 18 Dec 2020 18:57:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1632323B83 for ; Fri, 18 Dec 2020 18:57:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1632323B83 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 ED9C36B005C; Fri, 18 Dec 2020 13:57:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E62E76B005D; Fri, 18 Dec 2020 13:57:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D02FC6B0068; Fri, 18 Dec 2020 13:57:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0067.hostedemail.com [216.40.44.67]) by kanga.kvack.org (Postfix) with ESMTP id B7D9F6B005C for ; Fri, 18 Dec 2020 13:57:23 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 710EA181CE284 for ; Fri, 18 Dec 2020 18:57:23 +0000 (UTC) X-FDA: 77607311166.27.comb05_360d2362743f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 0AD753D678 for ; Fri, 18 Dec 2020 18:57:17 +0000 (UTC) X-HE-Tag: comb05_360d2362743f X-Filterd-Recvd-Size: 4923 Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Fri, 18 Dec 2020 18:57:16 +0000 (UTC) Received: by mail-lf1-f53.google.com with SMTP id h205so8015245lfd.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=Sw8Xcl6dENHALn5E54LVSkhJzkTsIL+LnzKaV+wBU6wROVAiwCB7QCxXQYG/B8puXX 9Xy9gwccGffg0HVHG+6vxMtPCiE9+fNgiucw5Hq4cJwoZfGJ7NtyEdsYdlh7uPjt6EhX JswDKygSdmqU60FHLpwQc2Uex9XGnxgZ3hA9Rf6+JhaiI2Kto9BLHztAz+M7FI4auFOb h9iSFLUqJvK90Dqya9S195qjTqO+3S6c2QkGvY69RyN2/aYFoZ/vkZC/K8j+YbTcKWcF hEXuzB2jaNiJJ5ABREEY+9QZHs1yS/oSKIrhDkWGSDkDaPInW23zpqHKCNtak4EGcTcX TwvA== X-Gm-Message-State: AOAM532AvrWN1eSsJ5wHr4tYKEZ+wDgvflB760Nban5/AV/MsicYonCG /dqhddP8xCfn/uVcGf+y97QDhkuohA/QJg== X-Google-Smtp-Source: ABdhPJyf5GOhDRs/sfIbI0BnYK5doLkNiAZPOYBgWXcfWswpWjQtOeDOr6xpI5BLWhkhofA4gtFaxw== X-Received: by 2002:a19:5d42:: with SMTP id p2mr140600lfj.308.1608317834277; Fri, 18 Dec 2020 10:57:14 -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 d24sm1134975lji.4.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-f44.google.com with SMTP id o17so8046107lfg.4 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" 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 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