memstat.sh
Function
Format
memstat.sh -a
memstat.sh -c settraceentry [stacklayer]
memstat.sh -c setmemstatswitch [value]
memstat.sh -h
memstat.sh -c setmodulefilter [midName]
memstat.sh -c showmoduletrace
memstat.sh -c showstatinfo
memstat.sh -c showmemstatswitch
memstat.sh -c showtraceentry
memstat.sh -c showmodulefilter
Usage Guidelines
The "memstat.sh" command is used to query memory usage of all kernel modules to monitor memory leakage. It provides the following functions:
- Enable or disable the function of collecting memory statistics.
- Show the switch value of enabling or disabling memory statistics collection.
- Show buddy and vmalloc memory occupied by all kernel modules.
- Set the number of call stack layers to be reserved. When setting the number of call stack layers, disable the function of collecting memory statistics.
- Show the number of call stack layers.
- Set a filtering module only from kernel modules in the current system.
- Show the configured filtering module.
- Show information about pages and call stacks used by the filtering module.
Example
-
Enable or disable the function of collecting memory statistics.
Storage: minisystem> memstat.sh -c setmemstatswitch 1 DANGER: You are going to perform a danger command.The execution of this command may consume some system memory. Suggestion: Before you perform this operation, make sure that the operation will not affect working of system. Have you read danger alert message carefully?(y/n) y Enter "I have read and understand the consequences associated with performing this operation." to confirm running this command. I have read and understand the consequences associated with performing this operation. Succeeded in setting the switch value. The switch value is 1. Storage: minisystem>
-
Show help information.
Storage: minisystem> memstat.sh -h memstat.sh [-h] [-a] [-c command] : It's just the memstat modules's command about memory info. Enter memstat.sh -a to obtain more information. Storage: minisystem>
-
Show the operations that can be performed using "memstat.sh".
Storage: minisystem> memstat.sh -a memstat.sh -c setmemstatswitch [value] : set memstat's switch, [value] is [0|1],0:close,1:open. memstat.sh -c settraceentry [stacklayer] : set the depth of the stack.[stacklayer] is [1-8]. memstat.sh -c setmodulefilter [midName] : set module filter, only can set kernel's module. memstat.sh -c showmoduletrace : show used page information according to module_filter. memstat.sh -c showstatinfo : show all module's memory info allocated by buddy, vmalloc, slab. memstat.sh -c showmemstatswitch : show memstat's switch. memstat.sh -c showtraceentry : show memstat's trace entry. memstat.sh -c showmodulefilter : show filter module. Storage: minisystem>
-
Show the switch value of enabling or disabling memory statistics collection.
Storage: minisystem> memstat.sh -c showmemstatswitch 1 Storage: minisystem>
-
Show buddy and vmalloc memory occupied by all kernel modules.
Storage: minisystem> memstat.sh -c showstatinfo Note: The unit of memory is bytes. module buddy vmalloc core_size libfc 0 0 188416 iocount 0 0 86016 os_test 0 0 16384 tgtscsi 0 0 2060288 flashcache 0 0 872448 nls_cp932_utf8 0 0 40960 context 0 0 8495104 vhost_protocol 0 0 122880 i2c_core 0 0 40960 dbapp 0 0 380928 hioce 0 0 249856 cache_ctrl 0 0 196608 lfcoe 0 0 69632 common_event 0 0 77824 auto_tiering 0 0 831488 econf 0 0 32768 fujitsu_dx8000 0 0 16384 lockd 0 0 487424 xt_conntrack 0 0 16384 hioct_toetom 0 0 319488 os_feeddog 0 0 16384 ixgbe 0 0 286720 iw_cm 0 0 36864 ibm_ds8k 0 0 28672 overloadctrl 0 0 212992 grain 0 0 3203072 btree 0 0 561152 logzone_ctrl 0 0 94208 omlib 0 0 77824 sysctrl 0 0 9945088 fcdrv 0 0 708608 reloc 0 0 327680 os_rnvramdev 0 0 16384 alm_client 0 0 77824 lic_kernel 0 0 114688 cliadapter 0 0 20480 ibtgt 0 0 102400 ftds_adapt 0 0 90112 auto_tiering_shim 0 0 69632 huawei_all 0 0 73728 nls_cp932 0 0 98304 nls_cp950 0 0 118784 dlmadapter 0 0 163840 netapp_fas 0 0 36864 nls_cp936 0 0 139264 nls_euc_jp 0 0 16384 agetty_query 0 0 16384 scm_kernel 0 0 40960 quark 0 0 376832 nvram 0 0 61440 msg_client 0 0 106496 nls_cp949 0 0 163840 scsi_transport_fc 0 0 61440 iscsi_comm 0 0 32768 cab 0 0 684032 acc 0 0 118784 crct10dif_common 0 0 16384 dca 0 0 16384 quota 0 0 2256896 crct10dif_pclmul 0 0 16384 ccdb_app 0 0 45056 smb3_failover 0 0 495616 xnet_agent 0 0 139264 ibc 0 0 24576 dbmanage 0 0 192512 dlmplug_ol 0 0 32768 dal 0 0 741376 i40e 229376 0 352256 igb 0 0 208896 dlmplug_rl 0 0 339968 adm 0 0 507904 ipmi_msghandler 0 0 49152 nbc 0 0 36864 dif 0 0 106496 dell_compellent 0 0 16384 eam 0 0 3567616 dcl 0 0 507904 nls_euc_tw 0 0 319488 tms_ramsan 0 0 16384 ckg 0 0 6381568 rss_action 0 0 761856 space_flow_ctrl 0 0 196608 hp_eva5000 0 0 16384 mic 0 0 36864 hdm 0 0 651264 foe 0 0 94208 dmi 0 0 2359296 ccdb_rpm 0 0 81920 nas_notify 0 0 16384 llc 0 0 16384 nla 0 0 36864 xt_multiport 0 0 16384 pciecard 0 0 1224704 protobuf_k 0 0 77824 cfgframe 0 0 1273856 sdd 0 0 303104 bgr 0 0 299008 nal 0 0 32768 mml_server 0 0 319488 8021q 0 0 36864 iod 0 0 17678336 repio_util 0 0 188416 nas_mirror 0 0 331776 drvtoecore 0 0 139264 cmm 0 0 28168192 ldm 0 0 1302528 pal 0 0 8790016 cln 0 0 4382720 mpa 0 0 1421312 iscsi_prot 0 0 1822720 ral 0 0 462848 kboxdriver 0 0 24576 sal 0 0 10170368 itc 0 0 266240 drv_iosubsys_nvme 0 0 16384 epl 0 0 1417216 smb 0 0 4874240 drm 0 0 131072 rel 0 0 1208320 spa 0 0 18739200 bsp 0 0 561152 sem 0 0 106496 spc 0 0 11018240 hioc_genalloc 0 0 16384 dbkernel 0 0 978944 dif_ctrl 0 0 16384 eam_ctrl 0 0 36864 bdm_ctrl 0 0 36864 rim 0 0 270336 diagnose 0 0 237568 pciecore 0 0 1056768 comm_mem 0 0 61440 nas_lock 0 0 675840 sio 0 0 1220608 rsf 0 0 1531904 lmr 0 0 1449984 cpy 0 0 2162688 mrm 0 0 176128 uio 0 0 16384 unflowlevel_ioc 0 0 532480 iscsi_initiator 0 0 303104 kvm 0 0 561152 sata_mml 0 0 110592 nas_klog 0 2109440 131072 ata_piix 0 0 36864 mrp 0 0 20480 ccdb_nvram_adapter 0 0 180224 lun 0 0 2035712 comm_rpc 0 0 253952 cnet_msg 0 0 110592 iodetect 0 0 28672 cmm_dump 0 0 16384 dha_collector 0 0 229376 qos 0 0 6098944 ptp 0 0 20480 macrosan_ms3000 0 0 16384 nas_ctrl 0 0 24576 drvframe 0 0 454656 stp 0 0 16384 pagepool 0 0 253952 vos 0 190636032 7950336 xve_transaction 0 0 167936 rtt 0 0 118784 pps_core 0 0 20480 xnet_pal 0 0 24576 ib_mad 0 0 57344 rep_temp 0 0 57344 metadata_sync 0 0 1875968 scsi_tgt 0 0 20480 pool_pub 0 0 24576 jbd2 0 0 106496 lun_ctrl 0 0 1425408 iscsi_sw 0 0 45056 bsp_mce_print 0 0 16384 osp_proc 0 0 16384 nls_iso8859_1 0 0 16384 xnet_mgt 0 0 176128 xnet_udp 0 0 184320 qos_ctrl 0 0 81920 fcportft 0 0 16384 smartlog 0 0 32768 cluster_monitor 0 0 528384 xt_limit 0 0 16384 ccdb_client 0 0 831488 reg_feeddog 0 0 16384 aa_krn 0 0 61440 rss_ctrl 0 0 81920 libata 0 0 212992 ibm_ds 0 0 45056 vmmscomm 0 0 69632 rep_hc 0 0 6582272 falcon_ipstor 0 0 16384 hp_eva 0 0 40960 bdm_adapter 0 0 442368 smb2 0 0 10833920 rss_util 0 0 4657152 sd_mod 0 0 49152 ombase 0 0 24576 hp_msa 0 0 28672 pciehp 0 0 372736 emc_dmx3k 0 0 16384 crct10dif_generic 0 0 16384 smb_manager 0 0 2220032 string_module 0 0 798720 nf_defrag_ipv4 0 0 16384 sa_krn 0 0 40960 mcachelayer 0 0 679936 nf_defrag_ipv6 0 0 53248 satahp 0 0 45056 sysevent 0 0 212992 signo_catch 0 0 53248 nas_proto_vfs 0 0 1142784 rep_hv 0 0 4292608 ext4 0 0 577536 bsp_adapter 0 0 118784 dlmfwk 0 0 1634304 rep_rm 0 0 5144576 fdstat 0 0 20480 ostorvfs 0 3211264 937984 msg_adapter 0 0 24576 os_panic_handler 0 0 16384 e1000e 0 0 270336 mlx4_core 0 0 315392 perf_kernel 0 0 200704 ioctrl 0 0 106496 nvram_sysinfo 0 0 20480 stackcheckframes 0 0 16384 drvmml 0 0 1413120 fujitsu_e4000 0 0 16384 ctrl_public 0 0 16384 common_info 0 0 53248 ahci 0 0 57344 nas_netlink 0 0 61440 cluster_lib 0 0 614400 extent 0 0 1630208 volume 0 0 2797568 sunrpc 0 0 1052672 drvtom 0 0 229376 agetty_interface 0 0 16384 fdsa 0 0 421888 crc_t10dif 0 0 16384 rep_3dc 0 0 954368 ccdb_ctrl 0 0 16384 vstore 0 0 274432 auth_rpcgss 0 0 65536 ibm_flash 0 0 16384 upgrade_bootdisk 0 0 16384 guide_all 0 0 16384 kmma 0 0 90112 product_net 0 0 20480 productconf 0 0 196608 kvdb 0 0 667648 bnet 0 0 180224 garp 0 0 16384 nfsd 0 856064 7143424 tddp 0 0 1216512 pair 0 0 1327104 ib_compat 0 0 16384 mlx4_ib 0 0 192512 os_die_handler 0 0 16384 xve_logzone 0 0 14192640 ftds 0 0 1863680 snap 0 0 8568832 fcpy 0 0 458752 ip_tables 0 0 24576 kbox 0 5881856 266240 nas_sysctrl 0 16384 2068480 nvme 0 0 434176 pmgr 0 0 512000 flow 0 0 131072 iscsi_seg 0 0 73728 commu_api 0 0 20480 transaction_ctrl 0 0 16384 loop 0 0 28672 mtgt 0 0 1449984 omadapter 0 0 45056 tppi 0 0 233472 util 0 0 536576 comm_task 0 0 1445888 scheduler 0 0 73728 xnet_pcie 0 0 303104 ib_uverbs 0 0 73728 xnet_rdma 0 0 118784 hvs_ilock 0 0 176128 mbcache 0 0 16384 emc_vplex 0 0 16384 ib_addr 0 0 20480 iptable_filter 0 0 16384 ea 0 0 49152 scsi_ctrl 0 0 86016 algorithm 0 0 16384 xnet_core 0 0 4141056 log_cbb 0 0 24576 kvm_intel 0 0 172032 os_oom_handler 0 0 16384 bdm_lib 0 0 946176 drv_iosubsys_ini 0 0 53248 pool_ctrl 0 0 856064 raid0 0 0 20480 raid1 0 0 36864 ib_umad 0 0 24576 nas_acl 0 0 999424 unfcommon 0 0 1249280 ib_core 0 0 126976 rdma_cm 0 0 53248 rocache 0 0 204800 audit_client_kernel 0 0 40960 ua 0 0 49152 db_plat 0 0 512000 sd 0 0 1785856 nf_conntrack_ipv4 0 0 16384 cxgb4 12386304 0 581632 pcielib 0 0 61440 osax_util 0 0 69632 transaction2 0 0 626688 pcieaer 0 0 442368 lm 0 0 1015808 sg 0 0 40960 nf_conntrack_ipv6 0 0 20480 drv_iosubsys_tgt 0 0 16384 tg 0 0 258048 rep_arb 0 0 1150976 tcp_bbr 0 0 20480 xnet_util 0 0 450560 mp 0 0 720896 irqbypass 0 0 16384 dbuffer 0 0 348160 hds_ams 0 0 16384 crosssite 0 0 827392 rm 0 0 4206592 nas_mem 0 2097152 172032 bonding 0 0 147456 vols_util 0 0 708608 iw_hioc 0 0 188416 ibm_svc 0 0 32768 spaceub 0 0 344064 zlib_deflate 0 0 28672 emc_clariion 0 0 49152 antivirus 0 0 167936 ip6_tables 0 0 28672 ipmi_si 0 0 57344 bsp_mml 0 0 176128 fs_ctrl 0 0 1130496 ibm_xiv 0 0 16384 nfs_charset_convert 0 0 65536 acpi_cpufreq 0 0 20480 rep_svc 0 0 2199552 ib_srpt 0 0 122880 nas_pum 0 0 90112 cache 0 0 4874240 forward 0 0 57344 nf_conntrack 0 0 126976 hds_usp 0 0 24576 comm_redolog 0 0 172032 upgrade_kern 0 0 372736 sysalarm_agent_netlink_k 0 0 16384 mmt_krn 0 0 28672 ib_cm 0 0 45056 netmgmt 0 0 221184 ip6table_filter 0 0 16384 ipmi_devintf 0 0 20480 ib_sa 0 0 36864 Storage: minisystem>
-
Set the number of call stack layers to be reserved. When setting the number of call stack layers, disable the function of collecting memory statistics.
Storage: minisystem> memstat.sh -c settraceentry 3 DANGER: You are going to perform a danger command. Memory consumption rises as the number of stack layers increases. Suggestion: Before you perform this operation, make sure that the operation will not affect working of system. Have you read danger alert message carefully?(y/n) y Enter "I have read and understand the consequences associated with performing this operation." to confirm running this command. I have read and understand the consequences associated with performing this operation. Succeeded in setting the number of call stack layers. The number of call stack layers is 3. Storage: minisystem>
-
Show the number of call stack layers.
Storage: minisystem> memstat.sh -c showtraceentry 3 Storage: minisystem>
-
Set a filtering module only from kernel modules in the current system.
Storage: minisystem> memstat.sh -c setmodulefilter ib_sa DANGER: You are going to perform a danger command. Only ib_sa is traced and the previously configured filter module will become invalid. Have you read danger alert message carefully?(y/n) y Are you sure you really want to perform the operation?(y/n) y Succeeded in setting the filtering module. The filtering module is ib_sa. Storage: minisystem>
-
Show the configured filtering module.
Storage: minisystem> memstat.sh -c showmodulefilter e1000e Storage: minisystem>
-
Show information about pages and call stacks used by the filtering module.
Storage: minisystem> memstat.sh -c showmoduletrace page[ffffea007efe6e00], pfn[33290680], size[32768], module[e1000e] [<ffffffff81170758>] __alloc_page_frag+0x88/0x180 [<ffffffff815191df>] __netdev_alloc_skb+0x6f/0x110 [<ffffffffa0c479eb>] e1000_clean_rx_irq+0x35b/0x440 [e1000e]page[ffffea0005e9ee00], pfn[1550264], size[32768], module[e1000e] [<ffffffff81170758>] __alloc_page_frag+0x88/0x180 [<ffffffff815191df>] __netdev_alloc_skb+0x6f/0x110 [<ffffffffa0c479eb>] e1000_clean_rx_irq+0x35b/0x440 [e1000e] Storage: minisystem>