Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp875469rdb; Tue, 30 Jan 2024 00:48:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IFAKMg5sCCYnfMl/YTsXtPiFN93TYzrK16TIbJfaP5L8K9fI/wrRKIfBjxqnvUSdaC6U9z5 X-Received: by 2002:ac2:4e08:0:b0:510:17b1:cfdd with SMTP id e8-20020ac24e08000000b0051017b1cfddmr5649508lfr.67.1706604479949; Tue, 30 Jan 2024 00:47:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706604479; cv=pass; d=google.com; s=arc-20160816; b=SnUwatDwaXovepk4ZpZ79uQBIsw4dZGCX/vL+zJDztScpqo3/qoMs7vwNve6eotwWw a0m5VrGxXpH+sEslJCVQ99TbKTcoPgACJ3B21qQqJRUD7roUNcMca6s9vANV/BtBhbE6 JgRs45zcIDoJIT3y+pU0L7m1ZMIWVva8VSpKaeBrZohGGGt5+u//leqBjnm03Kk9LvMU j5JVWLX5tQXF4Zayaz2grVFTwpf+Jx/DJtQtCEzqXiVzWhkoNfMkT19uMc7aEKUkFx4D yN7QRtaVf7mXg+FRNML+d/yZXMvHkq0Qbc4lzvlrvgw3iwDxy4gCy9Qx4BE8vOR2B2fD o15w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=dD9peHogi/iJnm05HnuNn6882VLHmL5cVJQXby5aMJU=; fh=VVjuivqjwQTGD3KqdtfMHM2u5ZCac4G8eN8eVGHfbQw=; b=jR5fpndRzEH/IQLIx4Ng1KD/qcO/SYPmcqe3BLE4qQUImnrEzh/G2z4RNGM/xhQJKO rmVsAGgH9GP4D0Xh6+My9N+QI9Qd90xdbZrcjD88sMy+KMc/sByep3rI79DAkNcQa7nQ CVBAQJo5cpBjQv9uJljW7yfTdTj8Dn6dzHPUUkU2va4woLtz96yWTgeHWtXXiwnndwjm iFmsDsOLwLun4J1Cgw18sA49eIhSGqreBGpyeVOApYhIgxEod1a2NrbZxLf1Me5oQ5ra QRS4TU8HjKTthsOntlNwEmwlvtz+quDVSzD2c3L/dgZn1p6zcQm2+o1ayjm73ivaSMQy aWSw== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-44171-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44171-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ez8-20020a056402450800b0055d3d9b189csi4185887edb.159.2024.01.30.00.47.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 00:47:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44171-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-44171-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44171-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 1FAF51F28AEF for ; Tue, 30 Jan 2024 08:47:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BD35E5822F; Tue, 30 Jan 2024 08:47:04 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9D35C38DEC; Tue, 30 Jan 2024 08:46:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706604422; cv=none; b=a634CN6/Bv9OkU3sdC7O2aNqYm6G/8TMz6UyhLHx4+RH3nJIkMke3FIC4M0QwwctA9ItXzTTvyxSRhuQgE/1xvZgJDecT+o2eF1xMNTqZ2AtngPYXshrmBsWlMDg4SDsROigRMSpKGSaK5u7tdHNwkWj/anTHl9emT3J1ozbhHI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706604422; c=relaxed/simple; bh=84ecXwbsd/BvqAcgY841C0nLUGHtRtatekrbUkT7Jng=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=XAuV7yCcSgLjeYvFxX3BL8OTp/9nL1u4R5zR/PcE+EEtWVQqAVtK+X/hOxjhNK35JOMKl+RT1tdYxfzbxAslPvU65CucgbWtRpnJjnkZV1UGg3rkjSbh/g9nDKr58cYzzO8Bhru4p1UH3CSEpCwds5J0igCmfch+JTA2XDWFJIw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 Cc: linux-mm@kvack.org, Andrew Morton , Matthew Wilcox , Catalin Marinas , Will Deacon , "Aneesh Kumar K.V" , Nick Piggin , Peter Zijlstra , Michael Ellerman , Christophe Leroy , "Naveen N. Rao" , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Arnd Bergmann , linux-arch@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@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 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! >