Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp1067833rdb; Fri, 16 Feb 2024 04:37:00 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWrV/oPwyekej9WkBgGocnerBVdkSkJd0OjeZK+2GdxNecnToYnZUptWJzdGvRX6pqBe2KjwSuW7/p5EEZfMj4amZ9h4PAqNYCJhVRJZw== X-Google-Smtp-Source: AGHT+IEGscaWU6EzjwyofKJK2ilxmhn5crLImG5nUuc8GVTwVn93EIztQf3gMS9Ww/OGUc9e+hi1 X-Received: by 2002:aa7:da11:0:b0:563:fe8d:6d7 with SMTP id r17-20020aa7da11000000b00563fe8d06d7mr882151eds.13.1708087020288; Fri, 16 Feb 2024 04:37:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708087020; cv=pass; d=google.com; s=arc-20160816; b=h8ZevTtWzpp7awdof46chUl32m5l0e857ur9D8ieMT6fxAbDgBzjKjgcQaKEYBLuMo 9kJiWm+6NuCmCtUmibT/YWhCplVuVhEkg18vp70r11j1llbdKLvXrFxRilpz9rFQ+zUk eBr+ZKel6SMf+tXHDAjUzqJYwIPLeq5BN3EBLR/GE7GtJuFcK6kiFQsXdkX1Pgy0Np0X 3ISClxCrD93hgIUB0PZGjICRc9YI4LTTcFL5/3xmNS42EujJyDi7cu6mBQ7sNjq1NBuJ XrDv8nb0KL1NKerE49b9ecgIVg0NsAmins9oAE+Cv+UEFZ0Ma5SEv1ZjKTisXN3bM7FT S4eg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=cNtECzRiDhUsTEdoCNh/dOrnaW6vsuUNvcbYAJRTRNo=; fh=r8G2JENgcRo/RTe4xvZO7IzPLZ7yvHykzgF2Da/HHrw=; b=UcI781W6GpVZaI7io8OG+EnQ71GW5JgG3I9pZjo9Q6JtrKvST0B7I+cSVyGc3/z1by eIg4BbJa4uQ3aaqWquYTYB/owsFgeNf8EtII+zCr+vXNnKKX5sGSWfP5Q1EifWiE1s6b /Xx0GnvD2EMGt4BDr7S2REE4sAoNEvEuSD1DWH1Km6Xa8r+lAMfsFW1E0/IuhHPSK5xW GJGMNfABQXwqhTvaqshWrzBVYhTfNJ9XAGOOVxJunr0RVLO95zwpelpxKkzoOGjLkBjQ tqsAIMkdRJPjNma0skYnEoHLkS7mwwtGNUBZZwQR4bpYUB2/w5LUDM/OtjfGg3d9799t n1EA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-68582-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68582-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 j11-20020aa7c40b000000b00560ce8fd505si1583360edq.581.2024.02.16.04.37.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 04:37:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68582-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 (google.com: domain of linux-kernel+bounces-68582-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68582-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 98C4F1F22AA1 for ; Fri, 16 Feb 2024 12:36:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB1FE128821; Fri, 16 Feb 2024 12:35:11 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4293F129A74 for ; Fri, 16 Feb 2024 12:35:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708086911; cv=none; b=LQxl8PUY9WPMvwSkxqIHB4geD1uxMVSnF4GfVSMFEKg+C4kYWFsggaxJv41MIfTm41vfGu72heoCtZASmT/PbKsbiSrwRXKL40MfXA7GIRo92g0XtHvdIBYlH/DlRNuIwKVk2r44t2spPAhsCiE9c5QBmfVHD5LTqCmtD8Rwh1E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708086911; c=relaxed/simple; bh=Pl4R/QWLLFRDsjgD9md2zsv8zdcqMfqx2HQS9GMeEz0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PRzqYMbAK/AR/xBI1c71A4uOuoCsV8C1t6Nh3oB2VpzaTrw40QBC6QXyayoT3qZAQIzdnjEu3DYnTgynJN7zmvQ9m6gYeV2qD7WY22GSGzU9Uu5y0OB28k0V+O0xaaiJp0yIDE9l5UMlG8/A1RiugBx0qmd5fs/WjB6owe+Fuvc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26F79C43394; Fri, 16 Feb 2024 12:35:05 +0000 (UTC) Date: Fri, 16 Feb 2024 12:35:03 +0000 From: Catalin Marinas To: Ryan Roberts Cc: Will Deacon , Ard Biesheuvel , Marc Zyngier , James Morse , Andrey Ryabinin , Andrew Morton , Matthew Wilcox , Mark Rutland , David Hildenbrand , Kefeng Wang , John Hubbard , Zi Yan , Barry Song <21cnbao@gmail.com>, Alistair Popple , Yang Shi , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 18/18] arm64/mm: Automatically fold contpte mappings Message-ID: References: <20240215103205.2607016-1-ryan.roberts@arm.com> <20240215103205.2607016-19-ryan.roberts@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240215103205.2607016-19-ryan.roberts@arm.com> On Thu, Feb 15, 2024 at 10:32:05AM +0000, Ryan Roberts wrote: > There are situations where a change to a single PTE could cause the > contpte block in which it resides to become foldable (i.e. could be > repainted with the contiguous bit). Such situations arise, for example, > when user space temporarily changes protections, via mprotect, for > individual pages, such can be the case for certain garbage collectors. > > We would like to detect when such a PTE change occurs. However this can > be expensive due to the amount of checking required. Therefore only > perform the checks when an indiviual PTE is modified via mprotect > (ptep_modify_prot_commit() -> set_pte_at() -> set_ptes(nr=1)) and only > when we are setting the final PTE in a contpte-aligned block. > > Signed-off-by: Ryan Roberts Acked-by: Catalin Marinas