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 Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8C806C46CD2 for ; Tue, 30 Jan 2024 08:48:09 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4TPJj424y3z3vyd for ; Tue, 30 Jan 2024 19:48:08 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=arm.com (client-ip=217.140.110.172; helo=foss.arm.com; envelope-from=ryan.roberts@arm.com; receiver=lists.ozlabs.org) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lists.ozlabs.org (Postfix) with ESMTP id 4TPJhL6fzmz3cYX for ; Tue, 30 Jan 2024 19:47:30 +1100 (AEDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9C161DA7; Tue, 30 Jan 2024 00:47:42 -0800 (PST) Received: from [10.57.79.54] (unknown [10.57.79.54]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D169F3F738; Tue, 30 Jan 2024 00:46:55 -0800 (PST) Message-ID: Date: Tue, 30 Jan 2024 08:46:55 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 1/9] mm/memory: factor out zapping of present pte into zap_present_pte() Content-Language: en-GB To: David Hildenbrand , linux-kernel@vger.kernel.org References: <20240129143221.263763-1-david@redhat.com> <20240129143221.263763-2-david@redhat.com> <40e87333-4da9-4497-a117-9885986e376a@arm.com> <8d19d635-2f55-4c0d-958b-0640f99ff0ce@redhat.com> From: Ryan Roberts In-Reply-To: <8d19d635-2f55-4c0d-958b-0640f99ff0ce@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, Alexander Gordeev , Christian Borntraeger , Arnd Bergmann , Vasily Gorbik , Peter Zijlstra , "Aneesh Kumar K.V" , linuxppc-dev@lists.ozlabs.org, Matthew Wilcox , linux-mm@kvack.org, Nick Piggin , Catalin Marinas , "Naveen N. Rao" , Andrew Morton , Will Deacon , Heiko Carstens , Sven Schnelle Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On 30/01/2024 08:41, David Hildenbrand wrote: > On 30.01.24 09:13, Ryan Roberts wrote: >> On 29/01/2024 14:32, David Hildenbrand wrote: >>> Let's prepare for further changes by factoring out processing of present >>> PTEs. >>> >>> Signed-off-by: David Hildenbrand >>> --- >>>   mm/memory.c | 92 ++++++++++++++++++++++++++++++----------------------- >>>   1 file changed, 52 insertions(+), 40 deletions(-) >>> >>> diff --git a/mm/memory.c b/mm/memory.c >>> index b05fd28dbce1..50a6c79c78fc 100644 >>> --- a/mm/memory.c >>> +++ b/mm/memory.c >>> @@ -1532,13 +1532,61 @@ zap_install_uffd_wp_if_needed(struct vm_area_struct >>> *vma, >>>       pte_install_uffd_wp_if_needed(vma, addr, pte, pteval); >>>   } >>>   +static inline void zap_present_pte(struct mmu_gather *tlb, >>> +        struct vm_area_struct *vma, pte_t *pte, pte_t ptent, >>> +        unsigned long addr, struct zap_details *details, >>> +        int *rss, bool *force_flush, bool *force_break) >>> +{ >>> +    struct mm_struct *mm = tlb->mm; >>> +    bool delay_rmap = false; >>> +    struct folio *folio; >> >> You need to init this to NULL otherwise its a random value when calling >> should_zap_folio() if vm_normal_page() returns NULL. > > Right, and we can stop setting it to NULL in the original function. Patch #2 > changes these checks, which is why it's only a problem in this patch. Yeah I only noticed that after sending out this reply and moving to the next patch. Still worth fixing this intermediate state I think. > > Will fix, thanks! >