You are on page 1of 2

memory 4GB

Used=1748(MB) Free= 826(MB) Cache=1482(MB)

Buffer=36(MB)

#free -m
total used free shared buffers cached
Mem: 4092 3270 826 0 36 1482
-/+ buffers/cache: 1748 2344
Swap: 4096 0 4096
total amount used free shared buffer cache
of memory memory memory memory (KB) (KB)
(KB) (KB) (KB) (KB)

Mem : used = Used + Buffer + Cache / free = Free


-/+ buffers/cache : used = Used / free = Free + Buffer + Cache

Figure 2-1 free command output

Useful parameters for the free command include:


-b, -k, -m, -g Display values in bytes, kilobytes, megabytes, and gigabytes
-l Distinguishes between low and high memory (Refer to 1.2, Linux memory
architecture on page 10.)
-c <count> Displays the free output <count> number of times

Memory used in a zone


Using the -l option, you can see how much memory is used in each memory zone.
Example 2-8 and Example 2-9 show the example of free -l output of 32 bit and 64 bit
systems. Notice that 64-bit systems no longer use high memory.

Example 2-8 Example output from the free command on 32 bit version kernel
[root@edam ~]# free -l
total used free shared buffers cached
Mem: 4154484 2381500 1772984 0 108256 1974344
Low: 877828 199436 678392
High: 3276656 2182064 1094592
-/+ buffers/cache: 298900 3855584
Swap: 4194296 0 4194296

Example 2-9 Example output from the free command on 64 bit version kernel
[root@lnxsu4 ~]# free -l
total used free shared buffers cached
Mem: 4037420 138508 3898912 0 10300 42060
Low: 4037420 138508 3898912
High: 0 0 0
-/+ buffers/cache: 86148 3951272

Chapter 2. Monitoring and benchmark tools 47


Swap: 2031608 332 2031276

You can also determine how many chunks of memory are available in each zone using
/proc/buddyinfo file. Each column of numbers means the number of pages of that order
which are available. In Example 2-10, there are 5 chunks of 2^2*PAGE_SIZE available in
ZONE_DMA, and 16 chunks of 2^3*PAGE_SIZE available in ZONE_DMA32. Remember how
the buddy system allocates pages (refer to Buddy system on page 13). This information
shows you how fragmented the memory is and gives you an idea of how many pages you can
safely allocate.

Example 2-10 Buddy system information for 64 bit system


[root@lnxsu5 ~]# cat /proc/buddyinfo
Node 0, zone DMA 1 3 5 4 6 1 1 0 2 0 2
Node 0, zone DMA32 56 14 2 16 7 3 1 7 41 42 670
Node 0, zone Normal 0 6 3 2 1 0 1 0 0 1 0

48 Linux Performance and Tuning Guidelines

You might also like