Turn private hugetlb mapping into VM_SHARED

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux