Re: [PATCH v9 2/3] mm: add a field to store names for private anonymous memory
From: Suren Baghdasaryan <surenb@google.com>
Date: 2021-09-06 15:52:37
Also in:
linux-fsdevel, linux-mm, lkml
From: Suren Baghdasaryan <surenb@google.com>
Date: 2021-09-06 15:52:37
Also in:
linux-fsdevel, linux-mm, lkml
On Sun, Sep 5, 2021 at 6:04 AM Pavel Machek [off-list ref] wrote:
Hi!quoted
quoted
the process is still running, so it has to have some sort of synchronization with every layer of userspace. Efficiently tracking the ranges requires reimplementing something like the kernel vma trees, and linking to it from every layer of userspace. It requires more memory, more syscalls, more runtime cost, and more complexity to separately track regions that the kernel is already tracking.Ok so far.quoted
quoted
This patch adds a field to /proc/pid/maps and /proc/pid/smaps to show a userspace-provided name for anonymous vmas. The names of named anonymous vmas are shown in /proc/pid/maps and /proc/pid/smaps as [anon:<name>]. Userspace can set the name for a region of memory by calling prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, start, len, (unsigned long)name);Would setting a 64-bit integer instead of name be enough? Even if each party would set it randomly, risk of collisions would be very low... and we'd not have to deal with strings in kernel.
Thanks for the question, Pavel. I believe this was discussed in this thread before and Colin provided the explanation with usage examples: https://lore.kernel.org/linux-mm/20200821070552.GW2074@grain/ (local). Thanks, Suren.
Pavel
--
--
To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com.