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=unavailable 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 97A9BC433DB for ; Sun, 27 Dec 2020 22:36:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6254E20866 for ; Sun, 27 Dec 2020 22:36:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726309AbgL0Wgf (ORCPT ); Sun, 27 Dec 2020 17:36:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726204AbgL0Wge (ORCPT ); Sun, 27 Dec 2020 17:36:34 -0500 Received: from mail-oi1-x22d.google.com (mail-oi1-x22d.google.com [IPv6:2607:f8b0:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86E15C061794 for ; Sun, 27 Dec 2020 14:35:53 -0800 (PST) Received: by mail-oi1-x22d.google.com with SMTP id 15so9928273oix.8 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=jTjsJF7pV0LxWxju7gO/Lp4QgKHImq3CJjVix0xzuUNjoruZHUkRh0gcGfWcs1BDMY Vic/jyASf8c5XXTWd27U3PrmLHk0IColvylSqEK8ZvvMkciw5FZQlu9r0KOG0uPFi6E5 1i7PPHCv61B1qykncVf1od2r4ijiey6regEY104icD7xCtp40xqnYhCCwKKR7bPK5QI8 zP/Li9+1EytfscZLo8wBBzv93KtUOKtFXPRTpVjCv0BXkOQtbnfxkk1E0gLHKfkrnFX0 gQYlJXXZhiFiet6OXH/xys5bCHuURRazRsCgGCO8c/WUxLgeV2nW8SqydVpkcQljXBxl ShlQ== X-Gm-Message-State: AOAM53111Pw8HqY9NCILMMtPH22EO8uagKJI3mf6YCw1le27hl1Rxm+X rhwrMhxiv8MbjgRVQjvWrjchKg== 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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-- 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-- 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=-10.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable 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 E80DAC433DB for ; Sun, 27 Dec 2020 22:39:04 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 95015224DE for ; Sun, 27 Dec 2020 22:39:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 95015224DE Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: MIME-Version:References:Message-ID:In-Reply-To:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jY1H+2XdMYS9EtOOZ9FSgOKWjyDs5vmvMogbdCh91rk=; b=hGikzfUkoXPp8ySvhGh30GHSO wPy7vAlIl9z50CM/QCr0x9F1A81OVMw0wFhCjkpxuiX6GcBlID8LaCa6GeqNB+9iz9E2byEVAhckZ wkq6DSQLoti+2qscVEnThqqfBp3dCdAg7A5O9y4ck2dI0l+B+GbSrRL6IpQotkWqcOxOGDeh4O+c+ inveGTKln1N0V6qUMWPY2mXi5ZOgXb46I9S8e5UqeCkvt8iDJkVOFjsEqV8gGoe9rXXrZ85/0kYAm 7RZDZgrH7mD8S4yIUKY5a6Zo5cXmJ5Hxtb0t3IcBONw3JRxdK3z+s+VScDskqPiibuBXVUUKj/UuK aY92OkwRg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ktedt-0006En-1T; Sun, 27 Dec 2020 22:36:01 +0000 Received: from mail-oi1-x231.google.com ([2607:f8b0:4864:20::231]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ktedp-0006Cz-63 for linux-arm-kernel@lists.infradead.org; Sun, 27 Dec 2020 22:35:58 +0000 Received: by mail-oi1-x231.google.com with SMTP id q205so9871278oig.13 for ; Sun, 27 Dec 2020 14:35:54 -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=AgoLtXVqQeKL5ma3qUPI017BoR6XJH/THYxi2ixYpxgDPiDraAXfJjkl6rHO18wUBL eDpWak/84Lvni3HsFPOG3K6h+jc6DBUXWC9bgTd0Yg5CspIqBwNAwATvbKEHT4KZq9XR zCsyONYAN5bWKJbEex20pbt+xGxlAzEwLe3GiqmXQE7MfQqjwAPIxHHzsukkFC8jvcc3 MyFjdvol9sow06v/pirGJ7JyohosiEWCqDilZ7/NUYvdvjDQa1zYTnJufdBLlUQ3gfb8 V18Ls6Og6NKXb8CFWTs9RHA65BAlvLmAiuYK8Q99CrDRFen68LGq7ozPxzgDMqRN1uFm LfNg== X-Gm-Message-State: AOAM531DXmm9zO3EwfPSLIQvU2jF4akKFS307X8PQh9ogryE5VRIiY0Q eR4pqipN/k9ji+pNeFV1zEmmaA== 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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201227_173557_281960_0F22104D X-CRM114-Status: GOOD ( 33.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Android Kernel Team , Jan Kara , Minchan Kim , Catalin Marinas , Hugh Dickins , Linux Kernel Mailing List , Matthew Wilcox , Linux-MM , Vinayak Menon , Linux ARM , "Kirill A. Shutemov" , Andrew Morton , Will Deacon , "Kirill A. Shutemov" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --0-1843390995-1609108551=:1091--