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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CF2EE77197 for ; Thu, 9 Jan 2025 08:02:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8E5596B0083; Thu, 9 Jan 2025 03:02:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8958F6B0085; Thu, 9 Jan 2025 03:02:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 75D436B0088; Thu, 9 Jan 2025 03:02:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 1EE046B0083 for ; Thu, 9 Jan 2025 03:02:27 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id CE510817A3 for ; Thu, 9 Jan 2025 08:02:26 +0000 (UTC) X-FDA: 82987171092.17.9A3B121 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf15.hostedemail.com (Postfix) with ESMTP id 289B1A000D for ; Thu, 9 Jan 2025 08:02:24 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=g5RFercy; spf=pass (imf15.hostedemail.com: domain of a.hindborg@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=a.hindborg@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736409745; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=JMp8Jx6Ok7Nbe4pS5K2RoQ56Kk9XPDWvTGnZfF12N8I=; b=BeuFZsO5zMiNVY0JrcJmWny8oqav0/Gh2gGgjt548Qmtc4BiTe/qGDFftppqW8iKD1qX0v gyJ3ewPvT7yTw1gc4vt+1W8lMWqg9sQopTX/bZSti6/UR4TqxNvKLnRCygE7NSGUUkcInc yoBK7d3f3hYtAmc6Q9Ee2vKzx2ZMysk= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=g5RFercy; spf=pass (imf15.hostedemail.com: domain of a.hindborg@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=a.hindborg@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736409745; a=rsa-sha256; cv=none; b=yOI1Om3TRW54ApQ2np4N2J7r46JdJdoqdbYWxU3ntdVY7i3ithLvRJuWA7bI1xyVFFaZRl zgQX+kCKS5hNAwolbnxZdG2r0E9DKFTweTADHDH8QX9B3rNGbmGN4cUAK/mjEbv0mhSrDj l7EX5Kv7LMg/utNi6diEmd7416eO7ew= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 213B45C5824; Thu, 9 Jan 2025 08:01:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E19AEC4CED2; Thu, 9 Jan 2025 08:02:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736409743; bh=dQz3jHTNKJoNI+Qg4ogr4k2g+NK7sXWwPNda11HaDNc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=g5RFercyAqU/mwGE8wT3Y2WadFb2203dmY0F8oTHugMk8vH/Cq7YWEfhDzOZqRIca OQiBW2gTwOvQ5k0cDhCbP4ffO7ynIQ3gQNwUCiFUuDpn4XUJKMayRTFZTPydas2SlP r0xjAqobBoEmCYWO933OppLYqujiHDzeIyh8Z07yLWg23Jtso1fo700HGSrbvL2YmP XgXdgKIbswSYyZr93aOPBuY5U9nb20E4VTFKksnTZnqkRZVal/C/WBXPIRqd8d3Rqy jkQBsrphbwE/Fs0Lyfd5z73Sd5rtc6yYO25PqxscJ6Maeybc/vpMQ4x0hCWu6RFVoo ParRCkQbM8KEw== From: Andreas Hindborg To: "Alice Ryhl" Cc: "Miguel Ojeda" , "Matthew Wilcox" , "Lorenzo Stoakes" , "Vlastimil Babka" , "John Hubbard" , "Liam R. Howlett" , "Andrew Morton" , "Greg Kroah-Hartman" , "Arnd Bergmann" , "Christian Brauner" , "Jann Horn" , "Suren Baghdasaryan" , "Alex Gaynor" , "Boqun Feng" , "Gary Guo" , =?utf-8?Q?Bj=C3=B6rn?= Roy Baron , "Benno Lossin" , "Trevor Gross" , , , Subject: Re: [PATCH v11 2/8] mm: rust: add vm_area_struct methods that require read access In-Reply-To: (Alice Ryhl's message of "Wed, 08 Jan 2025 13:21:08 +0100") References: <20241211-vma-v11-0-466640428fc3@google.com> <20241211-vma-v11-2-466640428fc3@google.com> <874j33ddxt.fsf@kernel.org> <51PsGz5tctBZlyC7TWAGRwZbM13r71BM1gtm1Y8F4j2w3FtKSXtkVrsvwILAqvSBPrFJzahyUVDum-JXO3yZUw==@protonmail.internalid> User-Agent: mu4e 1.12.7; emacs 29.4 Date: Thu, 09 Jan 2025 09:02:11 +0100 Message-ID: <87frlsbekc.fsf@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 289B1A000D X-Stat-Signature: egwwmozkm3zkdc8nengsxpogegtq1999 X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1736409744-317421 X-HE-Meta: U2FsdGVkX1+pQKl4fP7DadG3qpPrjKVqrA6XryoDUvWegmyc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JuNfQngenkcLBFpqZrmqpHEOCtCLtpEO76CCz7iV+gilvT+s5T0+A4zKnmdSR63ZBNdMyePAmpjbSDGc8E+b3iiN3MP4kkI75A5uxNh2CrULEwuHHayo9JfSPWu3TmxgFs0Gx25xKxmjT40vd3PFMwe2v8Jn1kP6lPujsfjhbmr3kxkhShl66YuvwuaWNi+RZ2gkY2cOQDqQM/05FIhRrzIOxlV/AfE2+ymyO9Qs7CTYErU X-Bogosity: Unsure, tests=bogofilter, spamicity=0.490509, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: "Alice Ryhl" writes: > On Mon, Dec 16, 2024 at 3:51=E2=80=AFPM Andreas Hindborg wrote: >> >> >> > + >> > + /// Zap pages in the given page range. >> > + /// >> > + /// This clears page table mappings for the range at the leaf lev= el, leaving all other page >> > + /// tables intact, >> >> I don't fully understand this docstring. Is it correct that the function >> will unmap the address range given by `start` and `size`, _and_ free the >> pages used to hold the mappings at the leaf level of the page table? > > If the vma owns a refcount on those pages, then the refcounts are dropped. Maybe drop the "at the leaf level leaving all other page tables intact". It confuses me, since when would this not be the case? How about this: This clears the virtual memory map for the range given by `start` and `size`, dropping refcounts to memory held by the mappings in this range. Th= at is, anonymous memory is completely freed, file-backed memory has its reference count on page cache folio's dropped, any dirty data will still be written back to disk as usual. > >> > and freeing any memory referenced by the VMA in this range. That is, >> > + /// anonymous memory is completely freed, file-backed memory has = its reference count on page >> > + /// cache folio's dropped, any dirty data will still be written b= ack to disk as usual. >> > + #[inline] >> > + pub fn zap_page_range_single(&self, address: usize, size: usize) { Best regards, Andreas Hindborg