[ILUG] "Swap-in" tool?
Kenn Humborg
kenn at bluetree.ie
Tue Oct 1 12:46:03 IST 2002
> On Tue, Oct 01, 2002 at 09:56:15AM +0100, Kenn Humborg wrote:
> > > i dunno, i think i'd write a c program that would take a pid as an arg
> > > and do the ptrace thing on that pid. then i'd write a perl program to
> > > walk pid's in /proc that would use a regex to weed out procs
> by peeking
> > > in /proc/<pid>/cmdline. seems pretty simple really.
> > Or maybe I'll just use pgrep(1). Yippee!
>
> so won't this work?
>
> for p in `pgrep -u kenn`; do
> strace -p $p > /dev/null 2>&1 &
> sleep 1;
> kill $!
> done
No. Just strace-ing a process won't cause all of its
pages to be made resident. In fact, if the process
is sitting there blocking (on a read from stdin for example)
then it will have pretty much no effect.
The idea is to use ptrace(2)'s PEEKDATA operation to
actually do a read from each page in the process's address
space, thus forcing the VM subsystem to make that page
resident.
Later,
Kenn
More information about the ILUG
mailing list