Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Aug 2001 09:43:17 -0500 (CDT)
From:      mark tinguely <tinguely@web.cs.ndsu.nodak.edu>
To:        bright@mu.org, tobez@tobez.org
Cc:        hackers@FreeBSD.ORG
Subject:   Re: VM statistics per process?
Message-ID:  <200108241443.f7OEhHm10518@web.cs.ndsu.nodak.edu>
In-Reply-To: <20010822205238.A15301@heechee.tobez.org>

next in thread | previous in thread | raw e-mail | index | archive | help

>  Worse, pmap_pid_dump() is undocumented, and I don't
>  understand what for(i=0;i<1024;i++) for(j=0;j<1024;j++) {} loop there is
>  supposed to do...   :-(
>
>  I'd appreciate if someone would explain this to me.

the process' virtual memory is mapped into physical memory with page
directory table entries that point to a page table entry that points
to physical memory. there are 1024 (4096 character buffer with 4 bytes
per physical address) in both the PDE and PTEs. So 1 PDE is a pointer
to 1024 PTE which point to 1024 4KB of physical memory.

the outer for loop get a reference to the page table. the inner loop
gets the physical pages mapped to the virtual address.

the commentary for the pmap_pid_dump(int pid) routine:

 for each process
   if valid vmspace
     get process physical memory mapping 
     for each physical memory page directory entry
	if page directory entry exists and is currently valid
	   for each physical meory page table entry
              if the virtual address is now into the kernel space
                 exit the routine
              end of if the virtual address is now into the kernel space
              if page table entry exists and is valid
                 get the vm_page associated with this physical page
                 print out the information about virtual and physical address
                 stats and pretting printing stuff
              end of if page table entry exists and is valid
	   end of for each physical meory page table entry
     end of for each physical memory page directory entry
   end of if valid vmspace
 end of for each process
 return stats of number of physical pages used in user space for all processes


Note: most/many of the PDE and PTE entries will be not mapped or invalid.
:wq

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200108241443.f7OEhHm10518>