
{"id":5899,"date":"2009-12-28T11:40:21","date_gmt":"2009-12-28T06:10:21","guid":{"rendered":"http:\/\/froisa.com\/?p=175"},"modified":"2009-12-28T11:40:21","modified_gmt":"2009-12-28T06:10:21","slug":"vmstat-m-2","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2009\/12\/28\/vmstat-m-2\/","title":{"rendered":"vmstat &#8211; Report virtual memory statistics"},"content":{"rendered":"<h4><u>A UNIX Command . vmstat -m <\/u><\/h4>\n<pre>\nCache                       Num  Total   Size  Pages\nfat_inode_cache              23     23    688     23\nfat_cache                   102    102     40    102\nisofs_inode_cache             0      0    656     12\nudf_inode_cache              23     23    712     23\nfuse_request                  0      0    632     25\nfuse_inode                    0      0    768     21\ndm_crypt_io                   0      0    152     26\nkcopyd_job                    0      0    368     22\ndm_uevent                     0      0   2608     12\ndm_rq_target_io               0      0    400     20\next3_inode_cache          11017  12882    824     19\next3_xattr                    0      0     88     46\njournal_handle              170    170     24    170\njournal_head                 36     36    112     36\nrevoke_table                256    256     16    256\nrevoke_record               128    128     32    128\nUDPLITEv6                     0      0   1024     16\nUDPv6                        16     16   1024     16\ntw_sock_TCPv6                 0      0    320     12\nTCPv6                        17     17   1856     17\ncfq_queue                   110    119    240     17\nCache                       Num  Total   Size  Pages\nbsg_cmd                       0      0    312     13\nmqueue_inode_cache           18     18    896     18\nhugetlbfs_inode_cache        13     13    624     13\ndquot                         0      0    256     16\ndnotify_mark                237    240    136     30\npid_namespace                15     15   2112     15\nuser_namespace                0      0   1072     15\nposix_timers_cache           23     23    176     23\nUDP-Lite                      0      0    832     19\nip_fib_hash                  46     46     88     46\narp_cache                    36     72    320     12\nRAW                         450    475    832     19\nUDP                          19     19    832     19\ntw_sock_TCP                  16     16    256     16\nTCP                          24     38   1664     19\nblkdev_queue                 18     18   1736     18\nblkdev_requests              34     44    360     22\nbip-256                       7      7   4224      7\nbip-128                       0      0   2176     15\nbip-64                        0      0   1152     14\nbip-16                       21     21    384     21\nCache                       Num  Total   Size  Pages\nsock_inode_cache            531    575    704     23\nfile_lock_cache              22     22    184     22\nnet_namespace                12     12   2560     12\nshmem_inode_cache           708    740    816     20\nAcpi-ParseExt              1385   1400     72     56\nAcpi-Namespace              816    816     40    102\ntask_delay_info             263    324    112     36\ntaskstats                    23     24    328     12\nproc_inode_cache           1240   1656    656     12\nsigqueue                     25     25    160     25\nbdev_cache                   19     19    832     19\nsysfs_dir_cache           16424  16524     80     51\ninode_cache                1175   1573    608     13\ndentry                     8128   9744    192     21\nbuffer_head              149614 206505    104     39\nvm_area_struct            13975  14520    184     22\nmm_struct                   101    119    960     17\nfiles_cache                 105    115    704     23\nsignal_cache                143    165   1088     15\nsighand_cache               140    165   2112     15\ntask_struct                 252    288   1728     18\nCache                       Num  Total   Size  Pages\nanon_vma                   6242   6834     40    102\nshared_policy_node         9171  10115     48     85\nnuma_policy                 170    170     24    170\nradix_tree_node           19547  19558    568     14\nidr_layer_cache             453    465    544     15\ndma-kmalloc-8192              0      0   8192      4\ndma-kmalloc-4096              0      0   4096      8\ndma-kmalloc-2048              0      0   2048     16\ndma-kmalloc-1024              0      0   1024     16\ndma-kmalloc-512              16     16    512     16\ndma-kmalloc-256               0      0    256     16\ndma-kmalloc-128               0      0    128     32\ndma-kmalloc-64                0      0     64     64\ndma-kmalloc-32                0      0     32    128\ndma-kmalloc-16                0      0     16    256\ndma-kmalloc-8                 0      0      8    512\ndma-kmalloc-192               0      0    192     21\ndma-kmalloc-96                0      0     96     42\nkmalloc-8192                 11     12   8192      4\nkmalloc-4096                582    616   4096      8\nkmalloc-2048                233    272   2048     16\nCache                       Num  Total   Size  Pages\nkmalloc-1024                596    656   1024     16\nkmalloc-512                 493    544    512     16\nkmalloc-256                 696    816    256     16\nkmalloc-128                 790    864    128     32\nkmalloc-64                 3047   3840     64     64\nkmalloc-32                  777   1024     32    128\nkmalloc-16                 2778   2816     16    256\nkmalloc-8                  4094   4096      8    512\nkmalloc-192                5795   6489    192     21\nkmalloc-96                  649    798     96     42\nkmem_cache                   42     42    192     21\nkmem_cache_node             128    128     64     64\n<\/pre>\n<p><\/p>\n<h4><u>UNIX Explanation<\/u><\/h4>\n<pre>\nvmstat  reports   information  about  processes,  memory,\npaging, block IO, traps, disks and cpu activity.\n<\/pre>\n<h4><u> Related Source Code Exposition<\/u><\/h4>\n<p><code><\/p>\n<p>int main(int argc, char *argv[]) {<br \/>\n  char *partition = NULL;<br \/>\n  int c;<\/p>\n<p>  while((c = getopt(argc, argv, \"VdafmDnp:S:s\")) != EOF) switch(c) {<br \/>\n      case 'V':<br \/>\n\tdisplay_version();<br \/>\n\texit(0);<br \/>\n      case 'd':<br \/>\n\tstatMode |= DISKSTAT;<br \/>\n\tbreak;<br \/>\n      case 'a':<br \/>\n\t\/* active\/inactive mode *\/<br \/>\n\ta_option=1;<br \/>\n        break;<br \/>\n      case 'f':<br \/>\n        \/\/ FIXME: check for conflicting args<br \/>\n\tfork_format();<br \/>\n        exit(0);<br \/>\n      case 'm':<br \/>\n        statMode |= SLABSTAT;<br \/>\n\tbreak;<br \/>\n      case 'D':<br \/>\n        statMode |= DISKSUMSTAT;<br \/>\n\tbreak;<br \/>\n      case 'n':<br \/>\n\t\/* print only one header *\/<br \/>\n\tmoreheaders=FALSE;<br \/>\n        break;<br \/>\n      case 'p':<br \/>\n        statMode |= PARTITIONSTAT;<br \/>\n\tpartition = optarg;<br \/>\n\tif (memcmp(partition, \"\/dev\/\", 5) == 0) partition += 5;<br \/>\n        break;<br \/>\n      case 'S':<br \/>\n\tswitch(optarg[0]) {<br \/>\n\tcase 'b': case 'B': dataUnit = UNIT_B; break;<br \/>\n\tcase 'k': dataUnit = UNIT_k; break;<br \/>\n\tcase 'K': dataUnit = UNIT_K; break;<br \/>\n\tcase 'm': dataUnit = UNIT_m; break;<br \/>\n\tcase 'M': dataUnit = UNIT_M; break;<br \/>\n\tdefault:<br \/>\n\t  fprintf(stderr, \"-S requires k, K, m or M (default is kb)\\n\");<br \/>\n\t  exit(EXIT_FAILURE);<br \/>\n\t}<br \/>\n\tszDataUnit[0] = optarg[0];<br \/>\n\tbreak;<br \/>\n      case 's':<br \/>\n        statMode |= VMSUMSTAT;<br \/>\n\tbreak;<br \/>\n      default:<br \/>\n\t\/* no other aguments defined yet. *\/<br \/>\n\tusage();<br \/>\n  }<br \/>\n<\/code><\/p>\n<h4><u> Source Code Highlight <\/u><\/h4>\n<pre>\nUsing getopt to select -m option for slabinfo.\n<\/pre>\n<h4><u> Featured Image<\/u><\/h4>\n<p><a href=\"http:\/\/www.trueangle.org\/wp-content\/uploads\/2011\/04\/8dbbd-vmstat-april-27-2.png\"><img decoding=\"async\" loading=\"lazy\" src=\"http:\/\/www.trueangle.org\/wp-content\/uploads\/2011\/04\/8dbbd-vmstat-april-27-2.png\" alt=\"\" title=\"vmstat-April-27\" width=\"406\" height=\"226\" class=\"alignnone size-full wp-image-5145\" srcset=\"https:\/\/www.trueangle.org\/wp-content\/uploads\/2011\/04\/8dbbd-vmstat-april-27-2.png 406w, https:\/\/www.trueangle.org\/wp-content\/uploads\/2011\/04\/8dbbd-vmstat-april-27-2-300x167.png 300w\" sizes=\"(max-width: 406px) 100vw, 406px\" \/><\/a><\/p>\n<h4><u> Related Knowledge <\/u><\/h4>\n<pre>\nPhysical  memory  the actual  RAM  installe  is a  finite\nresource on any system.  The Linux memory handler manages\nthe  allocation  of  that  limited  resource  by  freeing\nportions of physical memory when possible.\n\nAll  processes use  memory, of  course, but  each process\ndoesn't   need   all  its   allocated   memory  all   the\ntime. Taking advantage of  this fact, the kernel frees up\nphysical  memory by  writing some  or all  of  a process'\nmemory to disk until it's needed again.\n\nThe  kernel  uses paging  and  swapping  to perform  this\nmemory  management. Paging  refers  to writing  portions,\ntermed  pages, of  a process'  memory to  disk. Swapping,\nstrictly speaking, refers  to writing the entire process,\nnot  just part,  to  disk.  In  Linux,  true swapping  is\nexceedingly rare, but the terms paging and swapping often\nare used interchangeably.\n\nWhen pages  are written  to disk, the  event is  called a\npage-out, and when pages are returned to physical memory,\nthe event  is called a  page-in.A page fault  occurs when\nthe  kernel  needs a  page,  finds  it  doesn't exist  in\nphysical  memory  because  it  has  been  paged-out,  and\nre-reads it in from disk.\n\nPage-ins  are common,  normal  and are  not  a cause  for\nconcern.  For example, when  an application  first starts\nup, its  executable image and data are  paged-in. This is\nnormal behavior.\n\nPage-outs, however,  can be a  sign of trouble.  When the\nkernel detects that memory is running low, it attempts to\nfree  up  memory by  paging  out.Though  this may  happen\nbriefly from time to time, if page-outs are plentiful and\nconstant,  the  kernel  can  reach  a  point  where  it's\nactually spending more time managing paging activity than\nrunning   the   applications,   and  system   performance\nsuffers. This woeful state is referred to as thrashing.\n\nUsing  swap space  is  not inherently  bad. Rather,  it's\nintense paging activity that's problematic. For instance,\nif your  most-memory-intensive application is  idle, it's\nfine  for portions  of it  to be  set aside  when another\nlarge job  is active. Memory  pages belonging to  an idle\napplication are  better set aside  so the kernel  can use\nphysical memory for disk buffering.\n\nsource : http:\/\/www.linuxjournal.com\/article\/8178\n\n<\/pre>\n<p>&lt;!&#8211; <a href=\"http:\/\/en.wikipedia.org\/wiki\/Slab_allocation\">Slab Allocation<\/a><br \/>\n<a href=\"http:\/\/www.ibm.com\/developerworks\/linux\/library\/l-linux-slab-allocator\/\">Linux Slab Allocator.<\/a> &#8211;!&gt;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A UNIX Command . vmstat -m Cache Num Total Size Pages fat_inode_cache 23 23 688 23 fat_cache 102 102 40 102 isofs_inode_cache 0 0 656 12 udf_inode_cache 23 23 712 23 fuse_request 0 0 632 25 fuse_inode 0 0 768 21 dm_crypt_io 0 0 152 26 kcopyd_job 0 0 368 22 dm_uevent 0 0 2608 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2009\/12\/28\/vmstat-m-2\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;vmstat &#8211; Report virtual memory statistics&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":-1,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[83],"tags":[1655],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/5899"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=5899"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/5899\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=5899"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=5899"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=5899"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}