2007-11-12 18:23:11

by Tomasz Kłoczko

[permalink] [raw]
Subject: top lies ?


Some data showed by top command looks like completly trashed.
Fragment from top output:

Mem: 2075784k total, 2053352k used, 22432k free, 19260k buffers
Swap: 2096472k total, 136k used, 2096336k free, 1335080k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ SWAP nFLT WCHAN COMMAND
14515 mysql 20 0 1837m 563m 4132 S 39 27.8 27:14.20 1.2g 18 - mysqld

How it is possible that swap ussage is 136k and swapped out portion of (in
this case) mysqld process is 1.2g ?
Mayby some other data from /proc/<pid> shows some *real* data ?

Above is on procps 3.2.7 and kernel 2.6.22.12.

kloczek
--
-----------------------------------------------------------
*Ludzie nie maj? problem?w, tylko sobie sami je stwarzaj?*
-----------------------------------------------------------
Tomasz K?oczko, sys adm @zie.pg.gda.pl|*e-mail: [email protected]*


2007-11-12 22:26:17

by Jarek Poplawski

[permalink] [raw]
Subject: Re: top lies ?

Tomasz K?oczko wrote, On 11/12/2007 06:57 PM:

> Some data showed by top command looks like completly trashed.
> Fragment from top output:
>
> Mem: 2075784k total, 2053352k used, 22432k free, 19260k buffers
> Swap: 2096472k total, 136k used, 2096336k free, 1335080k cached
>
> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ SWAP nFLT WCHAN COMMAND
> 14515 mysql 20 0 1837m 563m 4132 S 39 27.8 27:14.20 1.2g 18 - mysqld
>
> How it is possible that swap ussage is 136k and swapped out portion of (in
> this case) mysqld process is 1.2g ?

It seems this bigger SWAP is virtual (not necessarily used yet), something
similar like here:

>From man ps:


"size SZ approximate amount of swap space that would be required if the process were to dirty
all writable pages and then be swapped out. This number is very rough!"


Regards,
Jarek P.

2007-11-13 00:15:03

by Andreas Schwab

[permalink] [raw]
Subject: Re: top lies ?

Tomasz K?oczko <[email protected]> writes:

> Some data showed by top command looks like completly trashed.
> Fragment from top output:
>
> Mem: 2075784k total, 2053352k used, 22432k free, 19260k buffers
> Swap: 2096472k total, 136k used, 2096336k free, 1335080k cached
>
> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ SWAP nFLT WCHAN COMMAND
> 14515 mysql 20 0 1837m 563m 4132 S 39 27.8 27:14.20 1.2g 18 - mysqld
>
> How it is possible that swap ussage is 136k and swapped out portion of (in
> this case) mysqld process is 1.2g ?

SWAP is just VIRT - RES. It means that 1.2g of the allocated virtual
address space is not resident, but it does not mean that all of it is
written to the swap space, it can also be part of a file based mapping.

Andreas.

--
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstra?e 5, 90409 N?rnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."

2007-11-13 02:23:34

by Tomasz Kłoczko

[permalink] [raw]
Subject: Re: top lies ?

On Tue, 13 Nov 2007, Andreas Schwab wrote:

> Tomasz K?oczko <[email protected]> writes:
>
>> Some data showed by top command looks like completly trashed.
>> Fragment from top output:
>>
>> Mem: 2075784k total, 2053352k used, 22432k free, 19260k buffers
>> Swap: 2096472k total, 136k used, 2096336k free, 1335080k cached
>>
>> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ SWAP nFLT WCHAN COMMAND
>> 14515 mysql 20 0 1837m 563m 4132 S 39 27.8 27:14.20 1.2g 18 - mysqld
>>
>> How it is possible that swap ussage is 136k and swapped out portion of (in
>> this case) mysqld process is 1.2g ?
>
> SWAP is just VIRT - RES. It means that 1.2g of the allocated virtual
> address space is not resident, but it does not mean that all of it is
> written to the swap space, it can also be part of a file based mapping.

OK but where I can find per process data about number of
pages/amout of memory in swap ?

kloczek
--
-----------------------------------------------------------
*Ludzie nie maj? problem?w, tylko sobie sami je stwarzaj?*
-----------------------------------------------------------
Tomasz K?oczko, sys adm @zie.pg.gda.pl|*e-mail: [email protected]*