Obtaining used pages on process exit?



Hello,

I am currently writing my first kernel module to extract data from
the kernel and bring it into user-space. As I understand, FreeBSD
only loads pages of the text segment that it is about to use by
registering its handler for page faults, and bringing in more pages
from the binary as needed. I want to track this progress, and report
the amount of pages it brought in on process exit.

The current idea I have and the path I'm following is as follows:
I register a callback in my module using EVENTHANDLER_REGISTER,
using 'process_exit' name. That gives me the proc structure on exit,
I then try to find the information I need using the p_vmspace member,
and try using vm_tsize for the number of pages. But this is the
number of pages in the virtual address space of the text segment,
which does not correlate to how many pages were actually brought
in.

For the context of this, I am trying to write a tiny utility, that
watches the execution of a process, and tracks how many pages were
actually used during its execution. It passes that knowledge to a
hopefully-to-be-written user-space utility that generates a new
binary using only those pages for the text segment. (If an execution
was to go outside that, a seg fault is okay.)

Any help is appreciated.


Thanks, Yan
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: System Password for 1997 Acromatic 2100, need more memory
    ... continuous load is automatically invoked if the control ... the control permits editing of the current program segment. ... At any point during program execution, ...
    (alt.machines.cnc)
  • Re: Obtaining used pages on process exit?
    ... As I understand, FreeBSD ... registering its handler for page faults, ... number of pages in the virtual address space of the text segment, ... actually used during its execution. ...
    (freebsd-hackers)
  • Re: Benchmarking under 16 bits.
    ... The execution environment of 16-bit segments is ... > Is that in a 16-bit segment, ... > But in a 16-bit segment, we know that the extra prefix bytes hurt you. ... dword aligned byte variables, but because it is faster to access ...
    (alt.lang.asm)
  • Benchmarking under 16 bits.
    ... > Yes, it is an obsolete program for a dead operating system, but this ... The execution environment of 16-bit segments is ... Is that in a 16-bit segment, ... running in a 16-bit segment under virtual-86 mode" I wouldn't even ...
    (alt.lang.asm)