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 BDB9BC02183 for ; Wed, 15 Jan 2025 11:04:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4DB016B0092; Wed, 15 Jan 2025 06:04:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 48B056B0093; Wed, 15 Jan 2025 06:04:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 32BB46B0095; Wed, 15 Jan 2025 06:04:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 137B66B0092 for ; Wed, 15 Jan 2025 06:04:02 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 95DB081327 for ; Wed, 15 Jan 2025 11:04:01 +0000 (UTC) X-FDA: 83009401482.23.FA0768F Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf27.hostedemail.com (Postfix) with ESMTP id E7CE540007 for ; Wed, 15 Jan 2025 11:03:59 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=nLdvckn5; spf=pass (imf27.hostedemail.com: domain of a.hindborg@kernel.org designates 147.75.193.91 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=1736939040; 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=789as3egX650hEqZlSNzgX+9gE3N4WATz9oyA0M7n5A=; b=w07G15FmykFxaoslRyDPH+sdXbr2Ycsu3lWdakmiBm9fUUva72ux8uavxv2Sbl0xrGj4pm vCu9AdVZpNm4FM8Yr1P2SJcnr+ffoeAIJQVn6sTsU1BQavHhW/5Bln4gRA8I6Aw2Dpsgaj skj2M3QuukX21cxOkXhxVVNbRP6muGc= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=nLdvckn5; spf=pass (imf27.hostedemail.com: domain of a.hindborg@kernel.org designates 147.75.193.91 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=1736939040; a=rsa-sha256; cv=none; b=Wl3KL8pP+gWmjryVWNFVobY+kPPF67LKJzf8rWbmJ0DaIXRY7T84C2uMfr7DroVzRO1VoK mnMS09wXq5K8wddDlerNn1vR05SFjnecr7jTLjVW7pZuvrbwo2PxFUV/pLJfPRDjkGqDIC 658ynimab4udgkPT6kvM9r+Sa5CyCMw= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 3FFC6A41C6F; Wed, 15 Jan 2025 11:02:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CFC9C4CEE1; Wed, 15 Jan 2025 11:03:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736939039; bh=HT6Tr5w3lKUkyN60NnsHJuAiQZUj0Z/T33fxTbCHbdQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=nLdvckn5Qd9IA4Oz0fC6n82GRqe6GVCHXkQaPDLSTzWXoVSsxP6kPvA1tY7AHYCEG vGWzBaicGl9BH3EOErGsH63zMwHaUs6sTebqmae4vz7eeFXYXaUgPzUkQ+YEQVSnx6 7uEux6b89dDqEFV5ksOMWpMJ5Q07GEY/t1x1fzcXfylIshhXwAPHzaCPXsn9ZKCNop 4i7sT1ju79s+pZwttATOkKZEW92NnGC3i3ZHoS8KRXK3cE4xayBGctQXI8duAsp0bO 9e4PMZC9wwy+LoCdnrdmskTZWL+CkSfWKD5J+EZvbw3mdE8zS6d+uJGhQwbEAOIE9u B7kvtP8liCdZA== 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 3/8] mm: rust: add vm_insert_page In-Reply-To: (Alice Ryhl's message of "Mon, 13 Jan 2025 11:02:24 +0100") References: <20241211-vma-v11-0-466640428fc3@google.com> <20241211-vma-v11-3-466640428fc3@google.com> <87o71bbys7.fsf@kernel.org> User-Agent: mu4e 1.12.7; emacs 29.4 Date: Wed, 15 Jan 2025 10:33:08 +0100 Message-ID: <8734hkfmln.fsf@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: E7CE540007 X-Stat-Signature: 6m1tuoyydoowd87th76hdbqe1y63fgif X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1736939039-280597 X-HE-Meta: U2FsdGVkX1+rYZLidnbKTiwrCdmhwQkoR7SVSQMy/iP4gM3L4Cma80mSzx2GIrAGehoiy4rqZXUYfhZomWmIphZv+rFnQIHq83bDSVV5NuythcsIJL5SNWvG0ryhJ1p22yXccHVJdt0sR5xieVV8svZLr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W1b1qGsNgSQVFsMZKjFU+owmB9GyWB5CNVdSpLULojtAl+hXdz5GZKXeZ5FVvGdWJJAtffnYNUgoOAlq6cVaRcuC3itnqrYvsu+/TaduAB4KhoZxPzRVsKKowJi59LW4+WR3DBWpOUbbplJeO5SzQ/nNFFkgMOI7qfacYyosABWkRxKf/Olq X-Bogosity: Ham, tests=bogofilter, spamicity=0.401394, 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: >> >> "Alice Ryhl" writes: >> >> > The vm_insert_page method is only usable on vmas with the VM_MIXEDMAP >> > flag, so we introduce a new type to keep track of such vmas. >> > >> > The approach used in this patch assumes that we will not need to encode >> > many flag combinations in the type. I don't think we need to encode mo= re >> > than VM_MIXEDMAP and VM_PFNMAP as things are now. However, if that >> > becomes necessary, using generic parameters in a single type would sca= le >> > better as the number of flags increases. >> > >> > Acked-by: Lorenzo Stoakes (for mm bits) >> > Signed-off-by: Alice Ryhl >> > --- >> > rust/kernel/mm/virt.rs | 71 +++++++++++++++++++++++++++++++++++++++++= ++++++++- >> > 1 file changed, 70 insertions(+), 1 deletion(-) >> > >> > diff --git a/rust/kernel/mm/virt.rs b/rust/kernel/mm/virt.rs >> > index 68c763169cf0..3a23854e14f4 100644 >> > --- a/rust/kernel/mm/virt.rs >> > +++ b/rust/kernel/mm/virt.rs >> > @@ -4,7 +4,15 @@ >> > >> > //! Virtual memory. >> > >> > -use crate::{bindings, mm::MmWithUser, types::Opaque}; >> > +use crate::{ >> > + bindings, >> > + error::{to_result, Result}, >> > + mm::MmWithUser, >> > + page::Page, >> > + types::Opaque, >> > +}; >> > + >> > +use core::ops::Deref; >> > >> > /// A wrapper for the kernel's `struct vm_area_struct` with read acce= ss. >> > /// >> > @@ -100,6 +108,67 @@ pub fn zap_page_range_single(&self, address: usiz= e, size: usize) { >> > ) >> > }; >> > } >> > + >> > + /// Check whether the `VM_MIXEDMAP` flag is set. >> >> Perhaps "Check whether the `VM_MIXEDMAP` flag is set. If so, return >> `Some`, otherwise `None` ? > > How about > > If the `VM_MIXEDMAP` flag is set, returns a `VmAreaMixedMap` to this > VMA, otherwise returns `None`. > > This follows the example of slice::as_ascii Sounds good =F0=9F=91=8D Best regards, Andreas Hindborg