From owner-freebsd-hackers Fri Aug 24 7:43:37 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from web.cs.ndsu.nodak.edu (web.cs.ndsu.NoDak.edu [134.129.125.7]) by hub.freebsd.org (Postfix) with ESMTP id 06C5D37B401 for ; Fri, 24 Aug 2001 07:43:35 -0700 (PDT) (envelope-from tinguely@web.cs.ndsu.nodak.edu) Received: (from tinguely@localhost) by web.cs.ndsu.nodak.edu (8.11.4/8.11.4) id f7OEhHm10518; Fri, 24 Aug 2001 09:43:17 -0500 (CDT) (envelope-from tinguely) Date: Fri, 24 Aug 2001 09:43:17 -0500 (CDT) From: mark tinguely Message-Id: <200108241443.f7OEhHm10518@web.cs.ndsu.nodak.edu> To: bright@mu.org, tobez@tobez.org Subject: Re: VM statistics per process? Cc: hackers@FreeBSD.ORG In-Reply-To: <20010822205238.A15301@heechee.tobez.org> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > 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