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.7 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 4034CC4361B for ; Mon, 14 Dec 2020 17:54:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8613A21D7F for ; Mon, 14 Dec 2020 17:54:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8613A21D7F 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 8AD566B0036; Mon, 14 Dec 2020 12:54:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8351E6B005C; Mon, 14 Dec 2020 12:54:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6FCBD6B005D; Mon, 14 Dec 2020 12:54:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0096.hostedemail.com [216.40.44.96]) by kanga.kvack.org (Postfix) with ESMTP id 53E406B0036 for ; Mon, 14 Dec 2020 12:54:28 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 0F0372464 for ; Mon, 14 Dec 2020 17:54:28 +0000 (UTC) X-FDA: 77592637416.02.sleep61_32130af2741c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id E403610097AA2 for ; Mon, 14 Dec 2020 17:54:27 +0000 (UTC) X-HE-Tag: sleep61_32130af2741c X-Filterd-Recvd-Size: 5566 Received: from mail-lf1-f65.google.com (mail-lf1-f65.google.com [209.85.167.65]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Mon, 14 Dec 2020 17:54:27 +0000 (UTC) Received: by mail-lf1-f65.google.com with SMTP id w13so32356800lfd.5 for ; Mon, 14 Dec 2020 09:54:27 -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=3LqrgkPy+zCNpdGlJy55sEFO1oQMSaaqQeWb7wVUwHM=; b=hmuyZCwirZ2/zGJKCeArmXdo6mSFxQOCOGuqa/Ao64WDftm8tQ/xhZi5Sc8oANDJ0g rQ6KOrZY7kx8LiaWvmMMd/x7m5erN8vLQcKKFxMz15g/biusPM3Dwscs2gXIuRKCVkkF 9HTacsBGIwnx354xB5tyw1XD0oJ05atjrlfoQ= 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=3LqrgkPy+zCNpdGlJy55sEFO1oQMSaaqQeWb7wVUwHM=; b=tEXDeAN/96chmac512LyMD/G9qK0an48H7Ywkla6Kd9EDrtCKEDwyZoDSpPE/nb+4M IwOMW0Mo7LJtNrg0PTTbX5ncBWpOMsvXy1Jt41X01Dw2gbZyx+BBOnihpJ7J76gftm6W BbzBwAfTmCNPQz+FFRrtCuuJKe07G/Fz+rpYQSMhszhoaK7S2s2nyJh8gQZNdoynaAgY Z6Pauwj6OlAR7PTrDMrkEG73qf4unIHDOokZKWkPdI5CVrgfr284K5F4+XsfAwhk3dTZ QHVOn50EaookDswbDFZG5Cb7KLyPwsBFVJ4U5/LEdaddz1pqn46E3zfQW5PyB0XKe5ru zDRg== X-Gm-Message-State: AOAM530x5zR17t2UC1qgEN6LYCpZeVWOxT7196PEbShwaQFX+KTKn8o8 BLsGS/0LzS6Or840u9OPmjwuHVe2FGfa4Q== X-Google-Smtp-Source: ABdhPJxWy+qIuLrNTYzrwAIv88BHRusW0dS5HNtWfr1bF6eqap9ZAHL4yHhhNF42oLzaDMdGU/82fg== X-Received: by 2002:a05:651c:1255:: with SMTP id h21mr11837091ljh.8.1607968465030; Mon, 14 Dec 2020 09:54:25 -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 q5sm2002816ljg.122.2020.12.14.09.54.22 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Dec 2020 09:54:23 -0800 (PST) Received: by mail-lf1-f42.google.com with SMTP id o13so9191232lfr.3 for ; Mon, 14 Dec 2020 09:54:22 -0800 (PST) X-Received: by 2002:a19:8557:: with SMTP id h84mr9392758lfd.201.1607968462385; Mon, 14 Dec 2020 09:54:22 -0800 (PST) MIME-Version: 1.0 References: <20201209163950.8494-1-will@kernel.org> <20201209163950.8494-2-will@kernel.org> <20201209184049.GA8778@willie-the-truck> <20201210150828.4b7pg5lx666r7l2u@black.fi.intel.com> <20201214160724.ewhjqoi32chheone@box> In-Reply-To: <20201214160724.ewhjqoi32chheone@box> From: Linus Torvalds Date: Mon, 14 Dec 2020 09:54:06 -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" , Matthew Wilcox Cc: "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 Mon, Dec 14, 2020 at 8:07 AM Kirill A. Shutemov wrote: > > Here it is. Still barely tested. Ok, from looking at the patch (not applying it and looking at the end result), I think the locking - at least for the filemap_map_pages() case - is a lot easier to understand. So you seem to have fixed the thing I personally found most confusing. Thanks. > I expected to hate it more, but it looks reasonable. Opencoded > xas_for_each() smells bad, but... I think the open-coded xas_for_each() per se isn't a problem, but I agree that the startup condition is a bit ugly. And I'm actually personally more confused by why xas_retry() is needed here, bit not in many other places. That is perhaps more obvious now that it shows up twice. Adding Willy to the cc in case he has comments on that, and can explain it to me in small words. [ https://lore.kernel.org/lkml/20201214160724.ewhjqoi32chheone@box/ for context ] And I actually think it might make even more sense if you moved more of the pmd handling into "filemap_map_pages_pmd()". Now it's a bit odd, with filemap_map_pages() containing part of the pmd handling, and then part being in filemap_map_pages_pmd(). Could we have a "filemap_map_pmd()" that does it all, and then the filemap_map_pages() logic would be more along the lines of if (filemap_map_pmd(vmf, xas)) { rcu_read_unlock(); return; } ... then handle pte's ... Hmm? There may be some shared state thing why you didn't do it, the above is mostly a syntactic issue. Thanks, Linus