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=-15.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, 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 06BE1C433DB for ; Sat, 26 Dec 2020 21:05:49 +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 B7A452184D for ; Sat, 26 Dec 2020 21:05:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B7A452184D 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:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:Message-ID:In-Reply-To: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=IPi54fp8gy76r4ACOKWrtsWO+eDDhO5rxapF8S44E1c=; b=1CycYJPX7/XPLo945fCgfMjE6 zxuP1tdyLLmf2AKgZHW+0PR/q6InMO7IH5gq2s7hfU0upNWPyse43iLDLcBs22/eH+i/ziOd23Gi2 q/RyO/438OKZLzyoUVxBNNrjP/IuvZGNkdHQLDQxVaBeY73fQdPtSxGeYi6RrPZB4LClHWELCwb0n X3Xl68DeZuVCrD57OHsMV6knjju+dE+d69ZVteFPF3P6Sdkw52+vlB+dHbzmALBwbiJKKTS6DTl4v sH9Wg0KrAITHOHndRA7HCHt/s4yJC86n71oYOYm+nFuch6HKTMXcKsHL4ddAxUP3A2PRxGfBsTcv2 U8B2+NiyA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ktGjW-00057v-3p; Sat, 26 Dec 2020 21:04:14 +0000 Received: from mail-oi1-x233.google.com ([2607:f8b0:4864:20::233]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ktGjS-00056t-NK for linux-arm-kernel@lists.infradead.org; Sat, 26 Dec 2020 21:04:12 +0000 Received: by mail-oi1-x233.google.com with SMTP id 15so7780993oix.8 for ; Sat, 26 Dec 2020 13:04:08 -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=Ug2cC4COVPLC8mUYk/AU6N3XeMv07OZAJCLKe97wdjM=; b=Avq6Xe+8Li3coUSLxoaL0P41sPCfY0qsbLYDU/E+jNxRN0wRmjmQb+27bds/F8cNJn 4gLjDmqbdC3jGuDAFanZlmbz3MoqdumM/dwLw8SRD1ngOrNtArDeSKVPkQoXK9FvhpQh Vlb1MvYWxq6Log5f9ewU/mwTWCWiyL1Dmpw9CGbv83WECKFdCZL5U5wMk1hlXbuiuX+e OQG68rW7XqQuYjDTSxPFW9E5LJMQ04VCzigc6rS8hO8nq7Bz5dzOw2OF++xdy3BArH4Y 1eQjW0XL5KSaIUUEjcgyDPU2rs48dZA89dIyuF9XWu+xGxaN00ZGO+tGwx1fQbVmufiY aLug== 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=Ug2cC4COVPLC8mUYk/AU6N3XeMv07OZAJCLKe97wdjM=; b=rp6iv2tLFbchuQkPXDhk+2sHwoHQHHEc3PBgl9CX7Wyj1Wg/ST6wR/ypO69Sg2tFgT H7TJZJCC/4smN3OYgrMfGaI5H051EI4QGbK8kNwU0uuR5R7Jo20bteYUuN5gnGgSPkIu O0Yx7Vi8nSM+ZU0sAgKVQvtiC/dqPo7MxgUCoqLYV78CsBJHMC0JJ2PXHjxzBj+UQiFI WqFNC9zDOdhoIthFk/k+RY3tepj0CeMh8Km2K6cCLUnkd7EKX7wI2zn/NxMvVdJQkQLP BNzQ2GDU9T3iyJmN7qdiLXWbAAk7pbg4XMR3xFP9WCJXdTXQb7UvHAKh774L268t/Fe6 76jA== X-Gm-Message-State: AOAM532VpCwq1NigKsGe9rS5BR4asd+xlGBx5/cuEavBc2piJGfYn49c q7VJgJYg86rZCfFhYrmk2ysD2g== X-Google-Smtp-Source: ABdhPJzWaV98BaCLOJggQeAevV7nlr+09PfWrr1zgmfPuaYmXZdbcc/YpfIPPieQfFhIyOWMZBmTug== X-Received: by 2002:aca:fc03:: with SMTP id a3mr8356823oii.145.1609016646405; Sat, 26 Dec 2020 13:04:06 -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 y65sm7683123oie.39.2020.12.26.13.04.04 (version=TLS1 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128); Sat, 26 Dec 2020 13:04:05 -0800 (PST) Date: Sat, 26 Dec 2020 13:03:53 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: "Kirill A. Shutemov" Subject: Re: [PATCH 1/2] mm: Allow architectures to request 'old' entries when prefaulting In-Reply-To: <20201226204335.dikqkrkezqet6oqf@box> Message-ID: References: <20201217105409.2gacwgg7rco2ft3m@box> <20201218110400.yve45r3zsv7qgfa3@box> <20201219124103.w6isern3ywc7xbur@box> <20201222100047.p5zdb4ghagncq2oe@box> <20201225113157.e7hmluffh56fszfc@box> <20201226204335.dikqkrkezqet6oqf@box> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201226_160410_806925_389082E4 X-CRM114-Status: GOOD ( 23.33 ) 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 , Linus Torvalds , Hugh Dickins , Linux Kernel Mailing List , Matthew Wilcox , Linux-MM , Vinayak Menon , Linux ARM , Catalin Marinas , Andrew Morton , Will Deacon , "Kirill A. Shutemov" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sat, 26 Dec 2020, Kirill A. Shutemov wrote: > On Sat, Dec 26, 2020 at 09:57:13AM -0800, Linus Torvalds wrote: > > Because not only does that get rid of the "if (page)" test, I think it > > would make things a bit clearer. When I read the patch first, the > > initial "next_page()" call confused me. > > Agreed. Here we go: > > From d12dea4abe94dbc24b7945329b191ad7d29e213a Mon Sep 17 00:00:00 2001 > From: "Kirill A. Shutemov" > Date: Sat, 19 Dec 2020 15:19:23 +0300 > Subject: [PATCH] mm: Cleanup faultaround and finish_fault() codepaths > > alloc_set_pte() has two users with different requirements: in the > faultaround code, it called from an atomic context and PTE page table > has to be preallocated. finish_fault() can sleep and allocate page table > as needed. > > PTL locking rules are also strange, hard to follow and overkill for > finish_fault(). > > Let's untangle the mess. alloc_set_pte() has gone now. All locking is > explicit. > > The price is some code duplication to handle huge pages in faultaround > path, but it should be fine, having overall improvement in readability. > > Signed-off-by: Kirill A. Shutemov Hold on. I guess this one will suffer from the same bug as the previous. I was about to report back, after satisfactory overnight testing of that version - provided that one big little bug is fixed: --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2919,7 +2919,7 @@ static bool filemap_map_pmd(struct vm_fa if (pmd_none(*vmf->pmd) && PageTransHuge(page) && - do_set_pmd(vmf, page)) { + do_set_pmd(vmf, page) == 0) { unlock_page(page); return true; } (Yes, you can write that as !do_set_pmd(vmf, page), and maybe I'm odd, but even though it's very common, I have a personal aversion to using "!' on a positive-sounding function that returns 0 for success.) I'll give the new patch a try now, but with that fix added in. Without it, I got "Bad page" on compound_mapcount on file THP pages - but I run with a BUG() inside of bad_page() so I cannot miss them: I did not look to see what the eventual crash or page leak would look like without that. Hugh _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel