Re: Ascertaining dirty pages
Re: Ascertaining dirty pages
- Subject: Re: Ascertaining dirty pages
- From: Terry Lambert <email@hidden>
- Date: Mon, 18 Feb 2008 11:26:56 -0800
On Feb 18, 2008, at 7:39 AM, Vincent Coetzee <email@hidden>
wrote:
Hi Steven,
I am aware of vmmap, but perhaps I did not make the nature of my
problem very clear. My application needs to know about these pages,
and needs to be able to access information about the pages.
Additionally vmmap does not tell one which pages are dirty, ,it just
tells you about virtual memory allocated to a process. I need to
know on a page by page basis (i.e. currently 4096 bytes per page)
which pages have been written to and the exact address of the
changes within the page.
You can't know which specific addresses in a page have changed,
without keeping shadow copies, raising an exception (by intentionally
setting the page permissions incorrectly), and then doing a byte
compare.
So for example, if you did a strcpy() of a 60 byte string including
the NUL, you would take 60 exceptions, have to remember all of them,
and figure out some way to aggregate them to account them to a single
"event", the strcpy() call.
Unless you are writing an "electric fence" type system, and this is
solely for debugging and you do not care if your application runs
1000's of time slower, this is the wrong approach to the problem.
For BSS data (global initialized data), the data is mapped in COW. The
vmmap utility will tell you if this data is written by having remapped
the region PRV, if the in core copy differs from the on disk copy,
since writing it triggers the COW.
For your own allocations, there are some tricks you can play, but they
mostly come down to using mallocdebug properly.
If you are using Objective C and have enabled garbage collection,
without explicit collection calls to create synchronization points
(and only looking after you hit one), the issue becomes significantly
more complex.
So tell us if you need the information at runtime vs. debug, and tell
us why you think you need the information at all, i.e. what problem
you are trying to solve that leads you to believe the data is necessary.
-- Terry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden