Sungju's Slow Life

Personal journal

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 following command.

echo m > /proc/sysrq-trigger

It will print out some messages on your screen as something similar like following.

SysRq : Show Memory
DMA per-cpu:
CPU    0: hi:    0, btch:   1 usd:   0
CPU    1: hi:    0, btch:   1 usd:   0
CPU    2: hi:    0, btch:   1 usd:   0
CPU    3: hi:    0, btch:   1 usd:   0
Normal per-cpu:
CPU    0: hi:  186, btch:  31 usd: 173
CPU    1: hi:  186, btch:  31 usd: 174
CPU    2: hi:  186, btch:  31 usd: 165
CPU    3: hi:  186, btch:  31 usd: 175
HighMem per-cpu:
CPU    0: hi:  186, btch:  31 usd:  36
CPU    1: hi:  186, btch:  31 usd:  56
CPU    2: hi:  186, btch:  31 usd:   7
CPU    3: hi:  186, btch:  31 usd:   3
active_anon:244635 inactive_anon:74164 isolated_anon:0
 active_file:303491 inactive_file:315696 isolated_file:0
 unevictable:0 dirty:4987 writeback:913 unstable:0
 free:30580 slab_reclaimable:20107 slab_unreclaimable:8831
 mapped:14616 shmem:3164 pagetables:3059 bounce:190
DMA free:8224kB min:64kB low:80kB high:96kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB iso
Free swap  = 5451488kB
Total swap = 5455864kB
1245184 pages RAM
1018370 pages HighMem
214926 pages reserved
579156 pages shared
539390 pages non-shared

At first, it could be something like gibberish. If you want to know meaning of each line, you should check it with kernel source. SysRq-‘m’ execute show_mem() function.

void show_mem(void)
        int total = 0, reserved = 0;
        int shared = 0, cached = 0;
        int highmem = 0;
        struct page *page;
        pg_data_t *pgdat;
        unsigned long i;
        unsigned long flags;

        printk(KERN_INFO "Mem-info:n");
        printk(KERN_INFO "Free swap:       %6ldkBn", nr_swap_pages<<(PAGE_SHIFT-10));
        for_each_online_pgdat(pgdat) {
                pgdat_resize_lock(pgdat, &flags);
                for (i = 0; i node_spanned_pages; ++i) {
                        page = pgdat_page_nr(pgdat, i);
                        if (PageHighMem(page))
                        if (PageReserved(page))
                        else if (PageSwapCache(page))
                        else if (page_count(page))
                                shared += page_count(page) - 1;
                pgdat_resize_unlock(pgdat, &flags);
        printk(KERN_INFO "%d pages of RAMn", total);
        printk(KERN_INFO "%d pages of HIGHMEMn", highmem);
        printk(KERN_INFO "%d reserved pagesn", reserved);
        printk(KERN_INFO "%d pages sharedn", shared);
        printk(KERN_INFO "%d pages swap cachedn", cached);

        printk(KERN_INFO "%lu pages dirtyn", global_page_state(NR_FILE_DIRTY));
        printk(KERN_INFO "%lu pages writebackn",
        printk(KERN_INFO "%lu pages mappedn", global_page_state(NR_FILE_MAPPED));
        printk(KERN_INFO "%lu pages slabn", global_page_state(NR_SLAB));
        printk(KERN_INFO "%lu pages pagetablesn",

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: