LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Correlation between "free -m" shared line & "/proc/meminfo" shmem RHEL 6.2 - Anyone? (http://www.linuxquestions.org/questions/linux-general-1/correlation-between-free-m-shared-line-and-proc-meminfo-shmem-rhel-6-2-anyone-4175437336/)

xenner 11-15-2012 04:30 PM

Correlation between "free -m" shared line & "/proc/meminfo" shmem RHEL 6.2 - Anyone?
 
Hi,

I would like to know, if anyone has any ideas, the correlation to the 'shared' memory column in "free -m" and the shmem when you do a "cat /proc/meminfo".
I was recently asked by a dba, which I support, why the shared memory in "free" was completely different to the "shmem" in /proc/meminfo".
Embarrassed, I returned to my desk and avoided the question, stating "I will get back to you".

Can someone please shed some light on this for me, as I have had no luck in searching for this answer.
REDHAT 6.2 (But I'm sure it's not limited to this flavour alone).

custangro 11-15-2012 04:58 PM

From the man page...

Code:

FREE(1)                      Linux User’s Manual                      FREE(1)

NAME
      free - Display amount of free and used memory in the system

SYNOPSIS
      free [-b | -k | -m] [-o] [-s delay ] [-t] [-l] [-V]

DESCRIPTION
      free displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel.  The shared memory column should be ignored; it is obsolete.

  Options
      The -b switch displays the amount of memory in bytes; the -k switch (set by default) displays it  in  kilobytes;  the  -m  switch  displays  it  in
      megabytes.

      The -t switch displays a line containing the totals.

      The -o switch disables the display of a "buffer adjusted" line.  If the -o option is not specified, free subtracts buffer memory from the used mem-
      ory and adds it to the free memory reported.

      The -s switch activates continuous polling delay seconds apart. You may actually specify any floating point number for delay, usleep(3) is used for
      microsecond resolution delay times.

      The -l switch shows detailed low and high memory statistics.

      The -V switch displays version information.

FILES
      /proc/meminfo-- memory information

SEE ALSO
      ps(1), slabtop(1), vmstat(8), top(1)

AUTHORS
      Written by Brian Edmonds.

It's probably not being displayed because it isn't reporting right.

--C

xenner 11-15-2012 05:11 PM

WOW!!!... I can't believe I missed that - considering I even read the man page... I'm so sorry about that.. I generally laugh at ppl that don't read it.

Okay, so the shared memory in the "free" command is obsolete, that's good news.
As a segue to this post then, am I correct in assuming that the /proc/meminfo - shmem is actually in fact shared memory? If so, what is it shared between? The OS and the applications? Is it displaying the reserved memory for the OS? Is it possible to change this to anything other than what it's set at? As I have two servers, supposedly configured the same. One has shmem as 288Kb and the other at 18769372Kb.

Thanks for your assistance.

*shaking head*... I still can't believe I skipped that in the man page. So sorry to everyone in the future that's reading this post... omg.

custangro 11-15-2012 05:36 PM

No worries...I've done the some countless times :-)

So shmem is what's in shared memory. The best way to find out is run the ipcs command

Code:

root@host# ipcs -m
Then run a (the <shmid> is what you found with the ipcs -m command)...

Code:

ipcs -m -i <shmid>
This shows more information about a specified segment including the PID of the process creating (cpid) and the last (lpid) using it.

This will output the shared memory usage, you can see the allocated segments with the corresponding sizes.

You can also look to see what's in shared memory

Code:

root@host# ls -l /dev/shm
You can adjust how much shmem is alloted with the sysctl command...to view current configs...

Code:

root@host# sysctl kernel.shm{max,all,mni}


All times are GMT -5. The time now is 01:27 AM.