> Hello, list,
>
> I am working on a tool to introspect live memory of KVM machines, and
> mmapping its memory, instead of calling process_vm_readv on every read, would
> increase its performance significantly. Understandably, almost all virtual
> machine monitors (like QEMU) create private mappings for the memory. So,
> trying to understand the memory managment subsystem I am hoping to write a
> kernel module to do the remappings, and conversion from private, to shared
> mappings.
>
> My current focus is on hugetlb pages. At first, I remapped the pages using
> remap_pfn_range, but there is a memory safety risk when the VM shuts off, and
> that memory gets used elsewhere. Now, I am trying to turn the underlying
> mapping into a shared one, so that the kernel can keep track of the memory
> used. What would be the best way to do so?
>
> I noticed there is resv_map that stores represented mappings, and while on
> private mappings it's on vma, on the shared ones - it is in the inode, but
> making the inode point to the VMAs map leads to a bus error in userspace. I
> must be missing some key pieces.
>
> Does anyone know how to best achieve what I am trying to? Or is it something
> fundamentally wrong to do?
>
> Many thanks,
> Auri B.
It appears I have been mistaken when it came to remap_pfn_range being memory
unsafe, I just haven't read get_user_pages_remote documentation attentively
enough. Sorry for that, this whole unshared -> shared mapping change is very
much not the right thing to do.
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies