Re: Digging in the (linux) swap file

2003-07-18 Thread Chris Benson
On Thu, Jul 17, 2003 at 11:14:16PM +0100, Steve Keay wrote:
 On Thu, Jul 17, 2003 at 06:55:59PM +0100, Paul Makepeace wrote:

 I don't think the kernel makes any per-process statistics visible.

there's a bunch of numbers in /proc/PID/{maps,stat,statm,status}
That might tell you something.  I'm afraid i lost interest before
finding out what the numbers meant.

-- 
Chris Benson



Re: Digging in the (linux) swap file

2003-07-18 Thread Dan Brook
Perhaps the Proc::ProcessTable module may be of some use?

http://search.cpan.org/author/DURIST/Proc-ProcessTable-0.38/ProcessTable.pm

Dan



Digging in the (linux) swap file

2003-07-17 Thread Paul Makepeace
Is anyone aware of tools that will show what processes, and what in
those processes are using the swap -- e.g. the data paged out? I found
nothing on freshmeat or google. There seem, funnily enough, to be plenty
of such tools for Windows.

I'm curious since I have about 180MB of swap used and it's been
gradually creeping up over the months (versus apache which I have to
regularly restart).

**

Trying to create another swap file, cfdisk can't re-read the partition
table, neither will blockdev --rereadpt (there's only been an addition
into the Extended partition). Is there some way for it to force a
re-read to update /proc/partitions so I can mkswap? The machine's remote
 not easily rebootable or single-user-mode-able (the obvious answers).

# swapon /dev/sda10
swapon: /dev/sda10: No such device or address
# blockdev --rereadpt /dev/sda
BLKRRPART: Device or resource busy
#

Paul

PS dd if=/dev/swap | strings revealed an awful lot of perl module names.
   A cpan process running since January was using 35MB RSS+40MB swap...

--
Paul Makepeace ... http://paulm.com/

What is the cat doing on my lap? Listen to the wind.
   -- http://paulm.com/toys/surrealism/



Re: Digging in the (linux) swap file

2003-07-17 Thread muppet

Paul Makepeace said:
 Is anyone aware of tools that will show what processes, and what in
 those processes are using the swap -- e.g. the data paged out?

top and ps show you what processes are using swap.  particularly, in the STAT
column, the W means that the process is sawpped out, except for kernel
processes.  it will also have the command printed in parentheses.

according to top(1):

   STAT The  state  of  the  task is shown here. The state is either S for
sleeping, D for uninterruptible sleep, R for running, Z  for  zom#8208;
bies,  or  T  for  stopped or traced. These states are modified by
trailing  for a process with negative nice value, N for a process
with  positive  nice value, W for a swapped out process (this does
not work correctly for kernel processes).

   COMMAND
The task’s command name, which will be truncated if it is too long
to be displayed on one line.  Tasks in memory  will  have  a  full
command line, but swapped#8208;out tasks will only have the name of the
program in parentheses (for example, (getty)).


as for picking apart what parts are in the swap, i dunno.  it's just a guess,
but i would wager that you could see old data in the swap partition, unless
there have been security-minded wiping algorithms put in.


-- 
muppet scott at asofyet dot org



Re: Digging in the (linux) swap file

2003-07-17 Thread Paul Makepeace
On Thu, Jul 17, 2003 at 01:44:22PM -0400, muppet wrote:
  Is anyone aware of tools that will show what processes, and what in
  those processes are using the swap -- e.g. the data paged out?
 
 top and ps show you what processes are using swap.  particularly, in the STAT

There's a critical difference between swapped out and paged out. Swapped
means the whole process is languishing whereas paged out just means some
portion of the process is there.

It's quite rare for processes (IME) to get completely swapped out.
Generally it's an indication a program is some system-related like
bdflush, or isn't being used at all (so kill it).

I'm interested in which processes have _anything_ paged, and which
pages. I'm hoping this will give some clue as to what's gradually using
up the memory, and even possibly help debug apache's constant bloating
without anything more invasive.

 as for picking apart what parts are in the swap, i dunno. it's
 just a guess, but i would wager that you could see old data in the
 swap partition, unless there have been security-minded wiping
 algorithms put in.

Indeed.

Paul

-- 
Paul Makepeace ... http://paulm.com/

If this website is shit, I am not the pope, then stones would sing and
 pebbles would dance.
   -- http://paulm.com/toys/surrealism/



Re: Digging in the (linux) swap file

2003-07-17 Thread Steve Keay
On Thu, Jul 17, 2003 at 06:55:59PM +0100, Paul Makepeace wrote:
 Is anyone aware of tools that will show what processes, and what in
 those processes are using the swap -- e.g. the data paged out?

If the machine is not thrashing (i.e. lots of i/o to the swapfile)
then perhaps the processes with large OT (size) but much smaller RSS
are candidates?

I don't think the kernel makes any per-process statistics visible.