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=-19.8 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1, USER_IN_DEF_DKIM_WL autolearn=ham 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 0FA7AC433DB for ; Sun, 27 Dec 2020 22:35:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 86123224DE for ; Sun, 27 Dec 2020 22:35:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 86123224DE Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7FB168D000E; Sun, 27 Dec 2020 17:35:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7AA1B8D0003; Sun, 27 Dec 2020 17:35:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 699218D000E; Sun, 27 Dec 2020 17:35:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0124.hostedemail.com [216.40.44.124]) by kanga.kvack.org (Postfix) with ESMTP id 509F48D0003 for ; Sun, 27 Dec 2020 17:35:54 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 194363625 for ; Sun, 27 Dec 2020 22:35:54 +0000 (UTC) X-FDA: 77640521028.19.sack93_2913c7c2748e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id 094441ACEA2 for ; Sun, 27 Dec 2020 22:35:54 +0000 (UTC) X-HE-Tag: sack93_2913c7c2748e X-Filterd-Recvd-Size: 7615 Received: from mail-oi1-f182.google.com (mail-oi1-f182.google.com [209.85.167.182]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Sun, 27 Dec 2020 22:35:53 +0000 (UTC) Received: by mail-oi1-f182.google.com with SMTP id x13so9935528oic.5 for ; Sun, 27 Dec 2020 14:35:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=fQaoGT1WsKurEcZ5FPrA2PwI+HJqjlmSQJREU5hdQWY=; b=Gt7nVgz64MDl4wbhJV2vv6JBpCJRURLqX5L6sYykirX4mfVoB676sz7tJyNaLA1UIU Y8zbODc434zb2EI15wm4ss3czRAAkrKckOxsqUwMfhqqB8KEtA9SCzdeo/5g421FFzld ZDIua8b3N8wsBB+9Aihlyn3HRq8cVNwfhn2FYDnQhgiS2BbQRl8KVbDspthojeH35tBb kN0tFaU9frv6tK6wSVceyenH6bPYtKtXFR/RggVd2wG6ckLk5heTzq8H76Ww7in9Wxil 7+gYOflRN09msy6hfp9dnON2/rrPUtlnJkWgwdKaYQeroL94FwRPbZz5wAu2YdNjFxEb afQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=fQaoGT1WsKurEcZ5FPrA2PwI+HJqjlmSQJREU5hdQWY=; b=a8g0F7lY5ldqJs1suXOKl4Z0rcgTRC4Mndht9TMq3O4jQo65NaYwceYvZtMU6UL2Qe eXPjdyQHLSL1FHZ/4ouaomYhwe9SamnY4thyVsPU/CBNEJD2VUrk6i85XquOity0WcfH yQ6/G5/BiWPTCf/NYOt7XwRtDk0a9UQQClIiLHn0xxlOkBZ8/zyL61bUd0lOapu3SGuC vqAgvlvme57qxWL18TB0IzyiNT2MdA6Lov4Yne89MqJG6PviStLBQeaQhyHb/fl1rzRg XV+C3Jdu/cLFdTZhLEXbV2QdKLG4O4zIcERZdHsEu9nLOsA6tT3pbgN/VRaGMnx3U8ch 1yPw== X-Gm-Message-State: AOAM530FaJqMLj4LMw6aXaPfVN6+uekDKItYZMir1idlzMxFY4k4XJqd jUKhHTYFkOHYXvIjZDN84RdKww== X-Google-Smtp-Source: ABdhPJyajmApFjlhCnz6/OC/AztgA380FMJdDzgi1exKgbUHJLGQ5ogHrqstpjRxBaO45jME0v5kXQ== X-Received: by 2002:aca:578d:: with SMTP id l135mr10391114oib.105.1609108552617; Sun, 27 Dec 2020 14:35:52 -0800 (PST) Received: from eggly.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id 59sm8820295oti.69.2020.12.27.14.35.49 (version=TLS1 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128); Sun, 27 Dec 2020 14:35:51 -0800 (PST) Date: Sun, 27 Dec 2020 14:35:32 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Linus Torvalds , Damian Tometzki cc: Hugh Dickins , "Kirill A. Shutemov" , 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 Subject: Re: [PATCH 1/2] mm: Allow architectures to request 'old' entries when prefaulting In-Reply-To: Message-ID: References: <20201225113157.e7hmluffh56fszfc@box> <20201226204335.dikqkrkezqet6oqf@box> <20201226224016.dxjmordcfj75xgte@box> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-1843390995-1609108551=:1091" 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: This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1843390995-1609108551=:1091 Content-Type: TEXT/PLAIN; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Sun, 27 Dec 2020, Damian Tometzki wrote: > On Sun, 27. Dec 11:38, Linus Torvalds wrote: > > On Sat, Dec 26, 2020 at 6:38 PM Hugh Dickins wrote: > > > > > > This patch (like its antecedents) moves the pte_unmap_unlock() from > > > after do_fault_around()'s "check if the page fault is solved" into > > > filemap_map_pages() itself (which apparently does not NULLify vmf->pt= e > > > after unmapping it, which is poor, but good for revealing this issue)= =2E > > > That looks cleaner, but of course there was a very good reason for it= s > > > original positioning. > >=20 > > Good catch. > >=20 > > > Maybe you want to change the ->map_pages prototype, to pass down the > > > requested address too, so that it can report whether the requested > > > address was resolved or not. Or it could be left to __do_fault(), > > > or even to a repeated fault; but those would be less efficient. > >=20 > > Let's keep the old really odd "let's unlock in the caller" for now, > > and minimize the changes. > >=20 > > Adding a big big comment at the end of filemap_map_pages() to note the > > odd delayed page table unlocking. > >=20 > > Here's an updated patch that combines Kirill's original patch, his > > additional incremental patch, and the fix for the pte lock oddity into > > one thing. > >=20 > > Does this finally pass your testing? Yes, this one passes my testing on x86_64 and on i386. But... > >=20 > > Linus > Hello together, >=20 > when i try to build this patch, i got the following error: >=20 > CC arch/x86/kernel/cpu/mce/threshold.o > mm/memory.c:3716:19: error: static declaration of =E2=80=98do_set_pmd=E2= =80=99 follows non-static declaration > static vm_fault_t do_set_pmd(struct vm_fault *vmf, struct page *page) > ^~~~~~~~~~ > In file included from mm/memory.c:43: > ./include/linux/mm.h:984:12: note: previous declaration of =E2=80=98do_se= t_pmd=E2=80=99 was here > vm_fault_t do_set_pmd(struct vm_fault *vmf, struct page *page); > ^~~~~~~~~~ > make[3]: *** [scripts/Makefile.build:279: mm/memory.o] Error 1 > make[2]: *** [Makefile:1805: mm] Error 2 > make[2]: *** Waiting for unfinished jobs.... > CC arch/x86/kernel/cpu/mce/therm_throt.o =2E.. Damian very helpfully reports that it does not build when CONFIG_TRANSPARENT_HUGEPAGE is not set, since the "static " has not been removed from the alternative definition of do_set_pmd(). And its BUILD_BUG() becomes invalid once it's globally available. You don't like unnecessary BUG()s, and I don't like returning success there: VM_FAULT_FALLBACK seems best. --- a/mm/memory.c +++ b/mm/memory.c @@ -3713,10 +3713,9 @@ out: =09return ret; } #else -static vm_fault_t do_set_pmd(struct vm_fault *vmf, struct page *page) +vm_fault_t do_set_pmd(struct vm_fault *vmf, struct page *page) { -=09BUILD_BUG(); -=09return 0; +=09return VM_FAULT_FALLBACK; } #endif =20 (I'm also a wee bit worried by filemap.c's +#include : that's the kind of thing that might turn out not to work on some arch.) Hugh --0-1843390995-1609108551=:1091--