I have an linux kernel 2.6.30 on an ARM based embedded device and I have to do some kernel memory usage profiling on the device.

I am thinking of monitoring the ps output on various kernel threads and modules while I carry out actions like wifi on/off etc.

Can you suggest me:

Which threads I need to monitor? How to monitor the kernel module memory usage?

1 Answer 1


There are several ways to monitor memory usage in a Linux system. Some may or may not be available depending on

  1. What version you are running
  2. How the kernel is configured
  3. What user-space tools are included in the root file-system

Since Linux typically is a virtual memory system, some statistics may be misleading and/or inaccurate. It is important to dig and understand what each statstic means.

With all that said, I typically monitor memory usage by running vmstat to get an idea of the total memory usage:

# vmstat -s
       127168  total memory
        44072  used memory
        33296  active memory
         2164  inactive memory
        83096  free memory
            0  buffer memory
        20468  swap cache
            0  total swap
            0  used swap
            0  free swap
       582750 non-nice user cpu ticks
            0 nice user cpu ticks
       160883 system cpu ticks
      7448748 idle cpu ticks
            0 IO-wait cpu ticks
        16066 IRQ cpu ticks
        18249 softirq cpu ticks
            0 stolen cpu ticks
            0 pages paged in
            0 pages paged out
            0 pages swapped in
            0 pages swapped out
     15079537 interrupts
     28629740 CPU context switches
   1344249586 boot time
        25532 forks

"free" Will also give you a bird's eye view of the memory usage. If I see anything unexpected, I will look on suspect processes by examining files in procfs. Good files to look at are

/proc/PID/maps - This lists all the memory currently mapped by the process

/proc/PID/smaps - Provides more details about how much memory is resident/shared/dirty/etc... This file can be verbose, but a Python script could be written to generate more meaningful data

  • The question is about kernel memory, not all memory. Sep 17, 2019 at 9:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.