Thread (34 messages) 34 messages, 6 authors, 2023-01-26

Re: [PATCH v2 1/6] mm: introduce vma->vm_flags modifier functions

From: Suren Baghdasaryan <surenb@google.com>
Date: 2023-01-25 16:50:49
Also in: alsa-devel, amd-gfx, bpf, dri-devel, intel-gfx, kexec, kvm, linux-acpi, linux-arch, linux-arm-msm, linux-crypto, linux-ext4, linux-fbdev, linux-fsdevel, linux-media, linux-mediatek, linux-mm, linux-perf-users, linux-rdma, linux-s390, linux-samsung-soc, linux-scsi, linux-staging, linux-tegra, linux-um, linux-usb, linux-xfs, linuxppc-dev, lkml, loongarch, netdev, nvdimm, selinux, sparclinux, target-devel, xen-devel

On Wed, Jan 25, 2023 at 1:10 AM Peter Zijlstra [off-list ref] wrote:
On Wed, Jan 25, 2023 at 12:38:46AM -0800, Suren Baghdasaryan wrote:
quoted
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index 2d6d790d9bed..6c7c70bf50dd 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -491,7 +491,13 @@ struct vm_area_struct {
       * See vmf_insert_mixed_prot() for discussion.
       */
      pgprot_t vm_page_prot;
-     unsigned long vm_flags;         /* Flags, see mm.h. */
+
+     /*
+      * Flags, see mm.h.
+      * WARNING! Do not modify directly.
+      * Use {init|reset|set|clear|mod}_vm_flags() functions instead.
+      */
+     unsigned long vm_flags;
We have __private and ACCESS_PRIVATE() to help with enforcing this.
Thanks for pointing this out, Peter! I guess for that I'll need to
convert all read accesses and provide get_vm_flags() too? That will
cause some additional churt (a quick search shows 801 hits over 248
files) but maybe it's worth it? I think Michal suggested that too in
another patch. Should I do that while we are at it?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help