Linux 2.6 : physical memory address and pid
Hi,
With the 2.6 Linux kernel, I want to find, from the physical page frame, the virtual address of the page loaded in the frame and the process id of the process owning it.
I know that 2.6 kernel implements rmap where the page points to a pte chain. But how to I get to the pid and virtual address from pte entry?
I have tried to become a member of this list. But don't have a confirmation yet. So, please cc the replies to me.
thanks,
Allison
Quoted 5 lines · firefly blue
Hi,
With the 2.6 Linux kernel, I want to find, from the physical page frame, the virtual address of the page loaded in the frame and the process id of the process owning it.
Follow struct page->mapping to struct address_space. A page can be mapped into any number of processes and multiple times per process so you'll need to walk the data structures there.
Signature · 1 line
Mathematics is the supreme nostalgia of our time.
Thanks for the answer!
Another related question :
I need to gather all application pages by reading the page tables. The hard part is, I need to do this from a PCI device using DMA. As I understand it, when a DMA is being performed, the pages are pinned in memory . Since the PCI device has grabbed the bus, the processor is not able to access memory to perform page replacement right ? So, this is a form of mutual exclusion.
However, if I have to fetch the page struct, the process address space of the process owning the page (I am ignoring shared pages to make things simpler) and the page itself, will a scatter gather DMA make sure that the processor cannot modify any of these data structures till the DMA is complete ? I am using Linux 2.6 and the i386 architecture.
thanks,
Allison
Quoted 14 lines · Matt Mackall
Quoted 5 lines · firefly blue
Hi,
With the 2.6 Linux kernel, I want to find, from the physical page frame, the virtual address of the page loaded in the frame and the process id of the process owning it.
Follow struct
page->mappingto structaddress_space. A page can be mapped into any number of processes and multiple times per process so you'll need to walk the data structures there.--
Mathematics is the supreme nostalgia of our time.