Skip to contentSkip to conversation

howto see shmem

DISCUSSION Martín Marqués 5 participants 7 messages Oct 24, 2001 – Oct 25, 2001

lore
Share & tools
lore
#0 lore raw

I have found out that /proc/meminfo doesn't have (at least that's my first thought) info about shared memory (it shows 0, even in heavy duty servers). ipcs also shows nothing, so how can I see the amount of shared memory being used?
Th mounted /dev/shmem device also shows 0 kb used (just in case).

Saludos... :-)

Signature · 8 lines
Porqué usar una base de datos relacional cualquiera,
si podés usar PostgreSQL?
-----------------------------------------------------------------
Martín Marqués                  |        [email protected]
Programador, Administrador, DBA |       Centro de Telematica
                       Universidad Nacional
                            del Litoral
-----------------------------------------------------------------
#1 lore raw

Hi,

Quoted 5 lines

I have found out that /proc/meminfo doesn't have (at least that's my first thought) info about shared memory (it shows 0, even in heavy duty servers). ipcs also shows nothing, so how can I see the amount of shared memory being used?
Th mounted /dev/shmem device also shows 0 kb used (just in case).

AFAIK you can't. Calculating how much shared mem is used in 2.4.x is just too hard...

Greets,
Marc.

#2 lore raw
In reply to Martín Marqués
Quoted 10 lines · Marc Brekoo

Hi,

Quoted 5 lines

I have found out that /proc/meminfo doesn't have (at least that's my first thought) info about shared memory (it shows 0, even in heavy duty servers). ipcs also shows nothing, so how can I see the amount of shared memory being used?
Th mounted /dev/shmem device also shows 0 kb used (just in case).

AFAIK you can't. Calculating how much shared mem is used in 2.4.x is just too hard...

And this:

# ipcs

------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 65536 nobody 600 46084 11 dest

------ Semaphore Arrays --------
key semid owner perms nsems status
0x00000000 393216 nobody 600 1

------ Message Queues --------
key msqid owner perms used-bytes messages

#

I can see 46084 bytes in shared memory used by the apache. Am I wrong?

Saludos... :-)

Signature · 8 lines
Porqué usar una base de datos relacional cualquiera,
si podés usar PostgreSQL?
-----------------------------------------------------------------
Martín Marqués                  |        [email protected]
Programador, Administrador, DBA |       Centro de Telematica
                       Universidad Nacional
                            del Litoral
-----------------------------------------------------------------
#3 lore raw
Quoted 7 lines · Martín Marqués

[...]
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 65536 nobody 600 46084 11 dest
[...]
I can see 46084 bytes in shared memory used by the apache. Am I wrong?

Nope. Applications know how much the are sharing because they can easily see what region of memory is shared/mapped into their's.

The reason the kernel can't figure out the net shared memory is because there is no simple way -- it has to add up the shared regions of all applications, counting each shared segment only once. Too much work.

Robert Love

#4 lore raw
In reply to Martín Marqués
Quoted 9 lines · Robert Love
Quoted 7 lines · Martín Marqués

[...]
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 65536 nobody 600 46084 11 dest
[...]
I can see 46084 bytes in shared memory used by the apache. Am I wrong?

Quoted 6 lines

Nope. Applications know how much the are sharing because they can easily see what region of memory is shared/mapped into their's.

The reason the kernel can't figure out the net shared memory is because there is no simple way -- it has to add up the shared regions of all applications, counting each shared segment only once. Too much work.

Yes, I guess you are right. I just checked on and old RH server with a 2.2.x kernel, and the sum of the shared memory of each application doesn't give me the amount of shared memory that free gives me.

Thanks to all!

Signature · 8 lines
Porqué usar una base de datos relacional cualquiera,
si podés usar PostgreSQL?
-----------------------------------------------------------------
Martín Marqués                  |        [email protected]
Programador, Administrador, DBA |       Centro de Telematica
                       Universidad Nacional
                            del Litoral
-----------------------------------------------------------------
#5 lore raw
In reply to Martín Marqués
Quoted 9 lines · Robert Love
Quoted 7 lines · Mart?n Marqu?s

[...]
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 65536 nobody 600 46084 11 dest
[...]
I can see 46084 bytes in shared memory used by the apache. Am I wrong?

Quoted 7 lines

Nope. Applications know how much the are sharing because they can easily see what region of memory is shared/mapped into their's.

The reason the kernel can't figure out the net shared memory is because there is no simple way -- it has to add up the shared regions of all applications, counting each shared segment only once. Too much work.

Actually, if it's done in the COW code, you could quite possibly get most of it right there...

Does anyone know of something that can make use of the shmem accting?

#6 lore raw
In reply to Martín Marqués

Hi Martín,

Quoted 3 lines · Martín Marqués

I have found out that /proc/meminfo doesn't have (at least that's my first thought) info about shared memory (it shows 0, even in heavy duty servers).

/proc/meminfo did show the number of shared pages in the whole system independent of SYSV shared mem.

In the -ac series it shows all shared anonymous pages (i.e. tmpfs, shared mmap and SYSV shm pages)

Quoted 2 lines

ipcs also shows nothing, so how can I see the amount of shared memory being used?

linux:~ # ipcs -mu

------ Shared Memory Status --------
segments allocated 3
pages allocated 256
pages resident 12
pages swapped 87
Swap performance: 0 attempts 0 successes

It shows it.

Quoted 1 line

Th mounted /dev/shmem device also shows 0 kb used (just in case).

That would only show the posix shared memory segments in this instance.

Greetings
Christoph