Responding to myself... max at bruningsystems.com wrote: > Hi Jim, > Jim Mauro wrote: >> >> mdb's memstat is cool in how it summarizes things, but it takes a very >> long time to run on large systems. memstat is walking page lists, so >> it should be quite accurate. >> If you can live with the run time of ::memstat, it's currently your >> best bet for memory accounting. >> > I have implemented a version of ::memstat that runs about 3 times > faster on my > 2GB laptop, and gives the almost exactly the results as the original > memstat. Here is what I do... > Instead of using the page walker which basically walks hash chains, I > read in > the pages off of the memseg list, and then just go through them. So, > does this > sound reasonable? The code for the modified memstat routine is attached. > See the README.memstat file for instructions on building and using. It would be even faster if there was a way to simply mmap each page_t array. This would get rid of mdb_alloc calls, and get rid of the copy between user and kernel space of the page_t that is done by mdb_vread. I can see that mdb eventually calls kvm_read, but it might be nice if there was a way to do mmap using the mdb modapi. Something like mdb_mmap(...). Any thoughts?
max