From patchwork Wed Nov 20 14:49:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alice Ryhl X-Patchwork-Id: 13881313 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 37657D711A8 for ; Wed, 20 Nov 2024 14:56:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B93056B0096; Wed, 20 Nov 2024 09:56:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B1DF46B0098; Wed, 20 Nov 2024 09:56:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8F9866B0099; Wed, 20 Nov 2024 09:56:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 6ACF16B0096 for ; Wed, 20 Nov 2024 09:56:24 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 53D8F160D04 for ; Wed, 20 Nov 2024 14:56:23 +0000 (UTC) X-FDA: 82806772272.25.EFE8EC0 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf09.hostedemail.com (Postfix) with ESMTP id C266E14001C for ; Wed, 20 Nov 2024 14:55:45 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=DAxYbkw2; spf=pass (imf09.hostedemail.com: domain of 3lPg9ZwkKCL0dolfhu1kojrrjoh.frpolqx0-ppnydfn.ruj@flex--aliceryhl.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3lPg9ZwkKCL0dolfhu1kojrrjoh.frpolqx0-ppnydfn.ruj@flex--aliceryhl.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732114489; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=hUP5pKIRXgXTZOS13MJMWQ9DFpxOfGZ7r+UgNJvVuSI=; b=dR4UZmZi9Q2seQ5dZX3k6djAo2CVn/dimhBwMWstP7RRMDAhE704jTFZTXNaRnPOgeSCLm HBOQe+lKYQ5PS7bqhnKki48jeimpXB2FJSwCAVBNO+cd4GaetNtF31MN7DjAtLj+Vhn8V4 OnXPT/bDq9gNkm6YITFOdqkFXuXMVQs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732114489; a=rsa-sha256; cv=none; b=mkcozUlOJvp0DxF4Je6yESZKnNQyYadwil85bUgbdcTXbsNBi7foMih4d+CiPgCH8Gng6W N2X/+fURVPnnhYJVx+Sff1l+ll7ChX45VssLd67nzsA1Owbu8jBpTcqVS4doM6CbjXoJGQ GC0Jusj84I/eDTzdme/S/WauKVBDqZ8= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=DAxYbkw2; spf=pass (imf09.hostedemail.com: domain of 3lPg9ZwkKCL0dolfhu1kojrrjoh.frpolqx0-ppnydfn.ruj@flex--aliceryhl.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3lPg9ZwkKCL0dolfhu1kojrrjoh.frpolqx0-ppnydfn.ruj@flex--aliceryhl.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6ea863ecfe9so41305657b3.3 for ; Wed, 20 Nov 2024 06:56:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1732114580; x=1732719380; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=hUP5pKIRXgXTZOS13MJMWQ9DFpxOfGZ7r+UgNJvVuSI=; b=DAxYbkw2FtuVCMB68ukxp7uf2X4mKHN9tWktowanAUhVtS/yUe7Y1tr/oi6ntRuoev nLPOh6Y9OqGbOsYPfwE03DfmL1fLlCETKXRb9nQwzB24+37qvQVN0JOA41ydtfe1t7M3 066yLKCDL0p+oanSWn/VFokgsDJ8yLku0r5V0iO0zmMqIUFfHTLsMYVsfQJ8fWuIumDG 1jIj16fnyXcOyA5Tuxk5uaC+OgXWnA5DJxQQ5ZP588jMpJaNV2y2pbHJO2Nj4SuPK8xq CXW3KUTLZUI7W7Ar2S0O/gV1gr9a6VP8qHun88jS4H3EVlz/t3uktGXwhnaiyqRMpfWF LACQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732114580; x=1732719380; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hUP5pKIRXgXTZOS13MJMWQ9DFpxOfGZ7r+UgNJvVuSI=; b=DzVx1uXQJ1uAgnnATC0T8/Xwh+L30dsqI/wxTn9p8YwhoBcq9ur4z0MrbGO8H4hqsD OrNkt0dMRc2BVRVrM2x3TJ2TeSc2YMWGIt7gGNhiD/OApzqcTMvSDi07qDJcpdJFIrxn PXwohv2MC7f9EV7ogIL3fH4qZoe9/10INqM9CPAhjF/BPDyIpItqK/zfneip5Vk1hGlt J5/hpxR/Fi0n0Utzhi1gFzKjfam5X92WSZ29oyq0fB0UYWhbRVhuf+w1CvniUs6EXHkB M0ps5hXBM0kwnflJYJLVcy/rZRlUsEW4DFYRS1oX1NpVd4mYD0LX9L/izkIselSsAX6X mOhA== X-Forwarded-Encrypted: i=1; AJvYcCVDyVYixIkMlJ5fg1qiMTa59rPjJeBeU9qXz68qLcB5b3vpVJBMlJFMdEsO8GLgo/pqSeiAQ3VQVg==@kvack.org X-Gm-Message-State: AOJu0YxyXU7hmJCiIR7MCoVMGHTvcIFYiW73jHSuw2g3v/e42IRxCsv7 zSKkeEwedLaY7G7X07sJ4Sca38XRaNncwtNCKzNrdDzSHkds9NS/y/tU0jx45UY9ShovJWXpZu3 93c3mjG3tUOJySA== X-Google-Smtp-Source: AGHT+IEG9WEVO32XNJycTeJbJu48vAwd8yZZDgjUr+05hjT6U66t/ondGMQmQEA/GIQ+PsqbB1I6Xqu/GnabS+U= X-Received: from aliceryhl.c.googlers.com ([fda3:e722:ac3:cc00:68:fe9:ac10:f29e]) (user=aliceryhl job=sendgmr) by 2002:a05:690c:5781:b0:6e2:ad08:4924 with SMTP id 00721157ae682-6eebd296195mr14787b3.4.1732114580372; Wed, 20 Nov 2024 06:56:20 -0800 (PST) Date: Wed, 20 Nov 2024 14:49:56 +0000 In-Reply-To: <20241120-vma-v8-0-eb31425da66b@google.com> Mime-Version: 1.0 References: <20241120-vma-v8-0-eb31425da66b@google.com> X-Developer-Key: i=aliceryhl@google.com; a=openpgp; fpr=49F6C1FAA74960F43A5B86A1EE7A392FDE96209F X-Developer-Signature: v=1; a=openpgp-sha256; l=8694; i=aliceryhl@google.com; h=from:subject:message-id; bh=Xqhb993p62ucfXpgqmTAzwF8zVU/iTXacAc64i+hvXs=; b=owEBbQKS/ZANAwAKAQRYvu5YxjlGAcsmYgBnPfiJtZ8e3RVRA+k2lDQWtngvEf9QEVRA3KEln +zY498BKQmJAjMEAAEKAB0WIQSDkqKUTWQHCvFIvbIEWL7uWMY5RgUCZz34iQAKCRAEWL7uWMY5 RpOaD/4yxq12q8wgIfSEmCve+/+Os+hqeA6WaIrFWW5ionzJ0gIAJ9cftQLGZTKFI8+rvupF8Lp dR1pbVHaU8sw+3jpSLHyp0jNLFTOL5gbGW1yFUHsGIjzxw9ZghQPcX+3vola7oY+NRtH0UmDDSf 8SHI4Dgs+ykt3Kxa09hTFwnho5mhAtnRKj2ngOcwoqWbTMeGi7vSEbENMrrIyTRmnN4JMfdtNSM w/yYL/NWvnBcoEgwTBvK3Nb1UOFaXc0Qbqs3Bjv0y9q/0WFl6Pflj7UA/Fnoy7ic1VZsxQUDmvs TqskcSB6vHZBhIne4/8r2NYal0rmG9qtI0u1O51X9qF+udqdWZtRJBrFDnWI9oEIWUaNE+THgG0 5/kSBR40GPZYjpwSdwM4HiyBlgxx74DpP9La+cyScGLvbsTOqG/8VkQLtlSus1MsYrElbH1Owqh fFYUr9RuGgxgFZVRxAnc0bIBTam6l6qUBZkUWO/Oa9wbwgq9laxBOwXXDAjr18IFTGblGKLyeCW 1YOxkDN0nbIADD4637WxbTL4l2wYEaDiGA1W5ZMdFdJugTmNZodJxoye7vDLMjEOx5d+dvf2/t7 gFm838Bm4GUkNA1Dm/Pjvht0d8hg0e9hRZx3uqJnRZIXU2Lt6DznOKYGva8smnLR0ySkWip8guU k0h7uXIHYMJyYWA== X-Mailer: b4 0.13.0 Message-ID: <20241120-vma-v8-2-eb31425da66b@google.com> Subject: [PATCH v8 2/7] mm: rust: add vm_area_struct methods that require read access From: Alice Ryhl To: Miguel Ojeda , Matthew Wilcox , Lorenzo Stoakes , Vlastimil Babka , John Hubbard , "Liam R. Howlett" , Andrew Morton , Greg Kroah-Hartman , Arnd Bergmann , Christian Brauner Cc: Alex Gaynor , Boqun Feng , Gary Guo , " =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= " , Benno Lossin , linux-kernel@vger.kernel.org, linux-mm@kvack.org, rust-for-linux@vger.kernel.org, Alice Ryhl , Andreas Hindborg X-Rspamd-Server: rspam10 X-Stat-Signature: gjhwmaxyajm1xts6cia6chwpb6upda63 X-Rspamd-Queue-Id: C266E14001C X-Rspam-User: X-HE-Tag: 1732114545-741940 X-HE-Meta: U2FsdGVkX1/L2Kk7FwAeGWBbMd6ekMJGZJc2+MqcAj7CpN9P6RCqJiJOoceeFzZI6RvWtCcixFPggqvd/rs8BEujdginM8yAsj5qqosAk+w51u1LZwzeVcjrdOcvKP8ZvaF2Uwfjq4qmpeB8E+6grmRtvomihUr9HmuDy3SZbN839HFoWRpGEMwhjGa+jtsdNmzh/ptA0Spji57H2JIHjb4axzVbCbuZba9/D9ulQbl0+fpsW8Fcmm9lfk3C6u4HcUbCpchdkuaZas1Aepuh9lwWuYwdAcpXDrQorNXlBmDMwTJ9ZwOgKl3J5LD6T2UOFgEP15/7gBO4NXkCK62RyuFmWGafKwOKCLpKWFpco8HihpQilI6qJ5vo1Y29DDNiEKldGSiJtac1cZUSkISVwpErIbajew8Y0mM0ZWG2eYz4BipXzjtg/vcS54R9ru+f53WvAtweeMDzfWbYy85gy8fEQ5zQdRzikF2erkF9TRfYxHA14c2qugAokRI6YmrLeOWLPVYBHZGfEDhAad2ks+rWOYgWSRebNfQ5pnnvkJeNa076vJGRh4F2lrOC3YQsUQkXxqh4Spd/yzRhfclYHSkaewuNoj/iRTeTyiY8qNHTbQkwGbz/ikbNB46onuWNmf7zF5rjBOe7+a/pxB27F9jyg7UjqUnWilYWsY3jXmOfUi83zHulwE8YTsDdzxkR1oxzwO6ALfUWHhbzvTkBs+dDUhidF1+Azm0en2QgEbAXH2KebLH/nrThSDi8p70jNf/OFS1+8fMcG5lFKZDQTRPlc4eVByFQiQKtqF8q52lyWwt9x66KM+/FoFZ8pJHsXMrUjLSZ38tPXr4RevWj6ca3ONQdlHYmcW00gbS0whZKCyjTGW2co/vL5DJT262INvXHArYYm3a7RhTY4X1IyWAr8YNngrll31m13B6rlWMbM4TWJgRe7WzFEq4LHa/WTKqh73RAWD7Si5t5a7D DBExphu4 Y7sVqBzXMcVLI6/2M83Fu11mshu13TZtzXPFS+mHfOP7nVCpPEwZUg1AZMLuXx4quHjSo8OQlmRmKd2kii5f4lyInWoczPpwBbSKZG7oTqZAF47XbBiWxdVNnCuzxr/sZFLk05ajh4FykMwiSxL8utMkoq1aJJdRwy6FqRx36KT2Y805XABMoYQnOYLH8E6DU43A8JfViFovlgVTlpwF+LqStUPl/38dJLM65e/V7Jy3RIHlFgc8Pp/l6Nm/eSmECx5ffG2eQ6XiKFOq4idGmhWUxylwDTBm4GX9nHevuIfOG63pLDGReN5FY9Ipq06BU2Bmte42NCeKBSq6WHi/JjxR76biiA/EOzQY4SjrovSB0Ns94Yi+aC4fBWSI0H3LOyf3mQPPyNr983qWmPzPDKSyU+ttldSsY6wt2QBSWjLSEQD3t+MkMQRyFpdvDWe1WY1VNghR8cuHkab0Mp83eQ484ayEidmwgkGTloGxk4nQ5Qmf2KWfGxiQOGB1ZDlayA2hIe8ESDD96CJMPh1d6idWnKK3VQ0lFltosLIz9ih688MPSh3Mo/gOHCTY8yURtLd6q2UPUh3g77CorSBwCijJNYDP8pz3J4k6JA7jEblH08FB7CsPUHKipGj1f4fOt+Da97PCCqhwGOuNDXkPAYTe+4EZIEj5jY0+h5GMbvojVS1YWAkbrmTcISw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000073, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This adds a type called VmAreaRef which is used when referencing a vma that you have read access to. Here, read access means that you hold either the mmap read lock or the vma read lock (or stronger). Additionally, a vma_lookup method is added to the mmap read guard, which enables you to obtain a &VmAreaRef in safe Rust code. Signed-off-by: Alice Ryhl --- rust/helpers/mm.c | 6 ++ rust/kernel/mm.rs | 21 ++++++ rust/kernel/mm/virt.rs | 171 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 198 insertions(+) diff --git a/rust/helpers/mm.c b/rust/helpers/mm.c index 7201747a5d31..7b72eb065a3e 100644 --- a/rust/helpers/mm.c +++ b/rust/helpers/mm.c @@ -37,3 +37,9 @@ void rust_helper_mmap_read_unlock(struct mm_struct *mm) { mmap_read_unlock(mm); } + +struct vm_area_struct *rust_helper_vma_lookup(struct mm_struct *mm, + unsigned long addr) +{ + return vma_lookup(mm, addr); +} diff --git a/rust/kernel/mm.rs b/rust/kernel/mm.rs index 84cba581edaa..ace8e7d57afe 100644 --- a/rust/kernel/mm.rs +++ b/rust/kernel/mm.rs @@ -12,6 +12,8 @@ }; use core::{ops::Deref, ptr::NonNull}; +pub mod virt; + /// A wrapper for the kernel's `struct mm_struct`. /// /// Since `mm_users` may be zero, the associated address space may not exist anymore. You can use @@ -210,6 +212,25 @@ pub struct MmapReadGuard<'a> { _nts: NotThreadSafe, } +impl<'a> MmapReadGuard<'a> { + /// Look up a vma at the given address. + #[inline] + pub fn vma_lookup(&self, vma_addr: usize) -> Option<&virt::VmAreaRef> { + // SAFETY: We hold a reference to the mm, so the pointer must be valid. Any value is okay + // for `vma_addr`. + let vma = unsafe { bindings::vma_lookup(self.mm.as_raw(), vma_addr as _) }; + + if vma.is_null() { + None + } else { + // SAFETY: We just checked that a vma was found, so the pointer is valid. Furthermore, + // the returned area will borrow from this read lock guard, so it can only be used + // while the mmap read lock is still held. + unsafe { Some(virt::VmAreaRef::from_raw(vma)) } + } + } +} + impl Drop for MmapReadGuard<'_> { #[inline] fn drop(&mut self) { diff --git a/rust/kernel/mm/virt.rs b/rust/kernel/mm/virt.rs new file mode 100644 index 000000000000..1e755dca46dd --- /dev/null +++ b/rust/kernel/mm/virt.rs @@ -0,0 +1,171 @@ +// SPDX-License-Identifier: GPL-2.0 + +// Copyright (C) 2024 Google LLC. + +//! Virtual memory. + +use crate::{bindings, types::Opaque}; + +/// A wrapper for the kernel's `struct vm_area_struct` with read access. +/// +/// It represents an area of virtual memory. +/// +/// # Invariants +/// +/// The caller must hold the mmap read lock or the vma read lock. +#[repr(transparent)] +pub struct VmAreaRef { + vma: Opaque, +} + +// Methods you can call when holding the mmap or vma read lock (or strong). They must be usable no +// matter what the vma flags are. +impl VmAreaRef { + /// Access a virtual memory area given a raw pointer. + /// + /// # Safety + /// + /// Callers must ensure that `vma` is valid for the duration of 'a, and that the mmap read lock + /// (or stronger) is held for at least the duration of 'a. + #[inline] + pub unsafe fn from_raw<'a>(vma: *const bindings::vm_area_struct) -> &'a Self { + // SAFETY: The caller ensures that the invariants are satisfied for the duration of 'a. + unsafe { &*vma.cast() } + } + + /// Returns a raw pointer to this area. + #[inline] + pub fn as_ptr(&self) -> *mut bindings::vm_area_struct { + self.vma.get() + } + + /// Returns the flags associated with the virtual memory area. + /// + /// The possible flags are a combination of the constants in [`flags`]. + #[inline] + pub fn flags(&self) -> vm_flags_t { + // SAFETY: By the type invariants, the caller holds at least the mmap read lock, so this + // access is not a data race. + unsafe { (*self.as_ptr()).__bindgen_anon_2.vm_flags as _ } + } + + /// Returns the start address of the virtual memory area. + #[inline] + pub fn start(&self) -> usize { + // SAFETY: By the type invariants, the caller holds at least the mmap read lock, so this + // access is not a data race. + unsafe { (*self.as_ptr()).__bindgen_anon_1.__bindgen_anon_1.vm_start as _ } + } + + /// Returns the end address of the virtual memory area. + #[inline] + pub fn end(&self) -> usize { + // SAFETY: By the type invariants, the caller holds at least the mmap read lock, so this + // access is not a data race. + unsafe { (*self.as_ptr()).__bindgen_anon_1.__bindgen_anon_1.vm_end as _ } + } + + /// Unmap pages in the given page range. + #[inline] + pub fn zap_page_range_single(&self, address: usize, size: usize) { + // SAFETY: By the type invariants, the caller has read access to this VMA, which is + // sufficient for this method call. This method has no requirements on the vma flags. Any + // value of `address` and `size` is allowed. + unsafe { + bindings::zap_page_range_single( + self.as_ptr(), + address as _, + size as _, + core::ptr::null_mut(), + ) + }; + } +} + +/// The integer type used for vma flags. +#[doc(inline)] +pub use bindings::vm_flags_t; + +/// All possible flags for [`VmAreaRef`]. +pub mod flags { + use super::vm_flags_t; + use crate::bindings; + + /// No flags are set. + pub const NONE: vm_flags_t = bindings::VM_NONE as _; + + /// Mapping allows reads. + pub const READ: vm_flags_t = bindings::VM_READ as _; + + /// Mapping allows writes. + pub const WRITE: vm_flags_t = bindings::VM_WRITE as _; + + /// Mapping allows execution. + pub const EXEC: vm_flags_t = bindings::VM_EXEC as _; + + /// Mapping is shared. + pub const SHARED: vm_flags_t = bindings::VM_SHARED as _; + + /// Mapping may be updated to allow reads. + pub const MAYREAD: vm_flags_t = bindings::VM_MAYREAD as _; + + /// Mapping may be updated to allow writes. + pub const MAYWRITE: vm_flags_t = bindings::VM_MAYWRITE as _; + + /// Mapping may be updated to allow execution. + pub const MAYEXEC: vm_flags_t = bindings::VM_MAYEXEC as _; + + /// Mapping may be updated to be shared. + pub const MAYSHARE: vm_flags_t = bindings::VM_MAYSHARE as _; + + /// Page-ranges managed without `struct page`, just pure PFN. + pub const PFNMAP: vm_flags_t = bindings::VM_PFNMAP as _; + + /// Memory mapped I/O or similar. + pub const IO: vm_flags_t = bindings::VM_IO as _; + + /// Do not copy this vma on fork. + pub const DONTCOPY: vm_flags_t = bindings::VM_DONTCOPY as _; + + /// Cannot expand with mremap(). + pub const DONTEXPAND: vm_flags_t = bindings::VM_DONTEXPAND as _; + + /// Lock the pages covered when they are faulted in. + pub const LOCKONFAULT: vm_flags_t = bindings::VM_LOCKONFAULT as _; + + /// Is a VM accounted object. + pub const ACCOUNT: vm_flags_t = bindings::VM_ACCOUNT as _; + + /// should the VM suppress accounting. + pub const NORESERVE: vm_flags_t = bindings::VM_NORESERVE as _; + + /// Huge TLB Page VM. + pub const HUGETLB: vm_flags_t = bindings::VM_HUGETLB as _; + + /// Synchronous page faults. + pub const SYNC: vm_flags_t = bindings::VM_SYNC as _; + + /// Architecture-specific flag. + pub const ARCH_1: vm_flags_t = bindings::VM_ARCH_1 as _; + + /// Wipe VMA contents in child.. + pub const WIPEONFORK: vm_flags_t = bindings::VM_WIPEONFORK as _; + + /// Do not include in the core dump. + pub const DONTDUMP: vm_flags_t = bindings::VM_DONTDUMP as _; + + /// Not soft dirty clean area. + pub const SOFTDIRTY: vm_flags_t = bindings::VM_SOFTDIRTY as _; + + /// Can contain `struct page` and pure PFN pages. + pub const MIXEDMAP: vm_flags_t = bindings::VM_MIXEDMAP as _; + + /// MADV_HUGEPAGE marked this vma. + pub const HUGEPAGE: vm_flags_t = bindings::VM_HUGEPAGE as _; + + /// MADV_NOHUGEPAGE marked this vma. + pub const NOHUGEPAGE: vm_flags_t = bindings::VM_NOHUGEPAGE as _; + + /// KSM may merge identical pages. + pub const MERGEABLE: vm_flags_t = bindings::VM_MERGEABLE as _; +}