kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Re: Turn private hugetlb mapping into VM_SHARED
@ 2020-07-14  8:55 heep
  0 siblings, 0 replies; 2+ messages in thread
From: heep @ 2020-07-14  8:55 UTC (permalink / raw)
  To: kernelnewbies

> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-14  8:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <t05ASlBD6RRi_zSEFljpStRYGL0yt7cmZI0644S9jYhI5TJtsIyNXh0IBgzzvzm-mexlUxSsOjUl54CQyse3DctieDa5pmDxDSCky5tIG0Y=@pm.me>
2020-07-12 20:38 ` Turn private hugetlb mapping into VM_SHARED heep
2020-07-14  8:55 heep

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).