Sungju's Slow Life

Personal journal


Memory

  • How to find the actual memory usage by each process

    Checking RSS gives you an idea how much physical memory is consumed at the moment. However, there are shared area such as shared object (.so), shared memory (shmget), etc. To get real amount consumed by application side, those shared area should be divided by the number of processes which is done by kernel in /proc/*/smaps… Continue reading

  • How to check memory usage in Linux – part 1. User space

    Here I am explaining how to check memory usage in the user space, especially from the command line. There are two perspective to see memory usage – System level and per-process level. System level memory usage check Per-process level memory usage check System level memory usage check free top /proc/meminfo /proc/buddyinfo /proc/pagetypeinfo vmstat /var/log/sa/ You… Continue reading

  • 5-level paging in KVM

    Latest kernels such as RHEL8 and above are supporting 5-level page table. You can check if this is available/enabled by looking at /boot/config-$(uname -r). If you don’t want to use 5-level page table, you can disable that by adding ‘no5lvl’ as a kernel parameter in grub file (/boot/grub2/grubenv) and reboot the system. This 5 level… Continue reading

  • What’s virtual address limit of 32bit/64bit Linux kernel?

    RHEL 5 code 32bit: include/asm-i386/processor.h /* * User space process size: 3GB (default). */ #define TASK_SIZE (PAGE_OFFSET) 64bit: include/asm-x86_64/processor.h /* * User space process size. 47bits minus one guard page. */ #define TASK_SIZE64 (0x800000000000UL – 4096) /* This decides where the kernel will search for a free chunk of vm * space during mmap’s. */… Continue reading

  • Personal memo for ‘Automatic NUMA Balancing’

    Automatic NUMA Balancing It is described in Documentation/sysctl/kernel.txt numa_balancing Enables/disables automatic page fault based NUMA memory balancing. Memory is moved automatically to nodes that access it often. Enables/disables automatic NUMA memory balancing. On NUMA machines, there is a performance penalty if remote memory is accessed by a CPU. When this feature is enabled the kernel… Continue reading

  • How to check which applications are using hugepages

    You can find how much is allocated and how much is actually used by HugePages by run the following command. $ grep -i huge /proc/meminfo AnonHugePages: 776192 kB HugePages_Total: 241 HugePages_Free: 113 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB But, there’s a time you also want to know which applications are actually used HugePages. You… Continue reading

  • Meaning of the SysRq-‘m’ output

    When you feel curious about what memory status is at some point, you can use SysRq facility. After enabling the sysrq featulre by execute following command, you just need to press ‘SysRq’ + ‘m’ or trigger the command. echo 1 > /proc/sys/kernel/sysrq Above command enables the SysRq feature. To get memory status, you can run… Continue reading