2009-09-23 03:50:07     about slab/slob memory footprint

Document created by Aaronwu Employee on Aug 19, 2013
Version 1Show Document
  • View in full screen mode

2009-09-23 03:50:07     about slab/slob memory footprint

Haitao Zhang (CHINA)

Message: 80301   

 

Hi, i'm looking for a memory footrpint efficiency kernel memory allocator,

 

besides slub, (designed for gain benifit for large systems or correct me if i'm wrong here)

 

i find slab is currently choosen by default blackfin kernel, better for avoid fragmentation?

 

but sounds like slob should be better for embedded systems have only very limited ram resource.

 

BTW: seems it's still black section on the following wik page,

 

  docs.blackfin.uclinux.org/doku.php?id=reduce_kernel_memory_footprint

 

so anybody can post some benchmark for use different allocators like slab and slob?

 

like doing comparision by running same kernel configured slab/slob, run userland apps.

 

i know the results may be very application related, but at least is a good reference.

TranslateQuoteReplyEditDelete

 

 

2009-09-23 06:33:04     Re: about slab/slob memory footprint

Sonic Zhang (CHINA)

Message: 80304   

 

A simple malloc performance test on bf548-ezkit with SVN trunk kernel.

 

--------- Slab -----------

 

root:/> cat /proc/meminfo

MemTotal:          60316 kB

MemFree:           47204 kB

Buffers:               0 kB

Cached:             7512 kB

SwapCached:            0 kB

Active:              616 kB

Inactive:           6848 kB

Active(anon):          0 kB

Inactive(anon):        0 kB

Active(file):        616 kB

Inactive(file):     6848 kB

Unevictable:           0 kB

Mlocked:               0 kB

MmapCopy:           2340 kB

SwapTotal:             0 kB

SwapFree:              0 kB

Dirty:                 0 kB

Writeback:             0 kB

AnonPages:             0 kB

Mapped:                0 kB

Slab:               2984 kB

SReclaimable:       1900 kB

SUnreclaim:         1084 kB

PageTables:            0 kB

NFS_Unstable:          0 kB

Bounce:                0 kB

WritebackTmp:          0 kB

CommitLimit:       30156 kB

Committed_AS:          0 kB

VmallocTotal:          0 kB

VmallocUsed:           0 kB

VmallocChunk:          0 kB

 

root:/> malloc-perf

00004k : 0x02081004  000000 000000 000000

00008k : 0x02ae6004  000000 000000 000000

00012k : 0x029d0004  000000 000000 000000

00016k : 0x02c6c004  000000 000000 000000

00020k : 0x02be0004  000000 000000 000000

00024k : 0x02b68004  000000 000000 000000

00028k : 0x02df0004  000000 000000 000000

00032k : 0x02df8004  000000 000031 004000

00036k : 0x02d70004  000000 000000 000000

00040k : 0x02d70004  000000 000031 004000

00044k : 0x02d70004  000000 000031 004000

00048k : 0x02d70004  000000 000031 004000

00052k : 0x02d70004  000000 000000 000000

00056k : 0x02d70004  000000 000062 004000

00060k : 0x02d70004  000000 000031 004000

00064k : 0x02d70004  000000 000000 000000

00068k : 0x02a40004  000000 000062 004000

00072k : 0x02a40004  000000 000031 004000

00076k : 0x02a40004  000000 000031 004000

00080k : 0x02a40004  000000 000000 000000

00084k : 0x02a40004  000000 000031 004000

00088k : 0x02a40004  000000 000031 004000

00092k : 0x02a40004  000000 000000 000000

00096k : 0x02a40004  000000 000031 004000

00100k : 0x02a40004  000000 000031 004000

00104k : 0x02a40004  000000 000000 000000

00108k : 0x02a40004  000000 000000 000000

00112k : 0x02a40004  000000 000031 004000

00116k : 0x02a40004  000000 000031 004000

00120k : 0x02a40004  000000 000062 004000

00124k : 0x02a40004  000000 000000 000000

00128k : 0x02a40004  000000 000000 000000

00256k : 0x02a00004  000000 000000 000000

00384k : 0x02e00004  000000 000062 004000

00512k : 0x02e00004  000000 000031 004000

00640k : 0x02e00004  000000 000000 000000

00768k : 0x02e00004  000000 000031 004000

00896k : 0x02e00004  000000 000031 004000

01024k : 0x02e00004  000000 000062 004000

TEST PASS

 

root:/> cat /proc/meminfo

MemTotal:          60316 kB

MemFree:           47204 kB

Buffers:               0 kB

Cached:             7512 kB

SwapCached:            0 kB

Active:              636 kB

Inactive:           6828 kB

Active(anon):          0 kB

Inactive(anon):        0 kB

Active(file):        636 kB

Inactive(file):     6828 kB

Unevictable:           0 kB

Mlocked:               0 kB

MmapCopy:           2340 kB

SwapTotal:             0 kB

SwapFree:              0 kB

Dirty:                 0 kB

Writeback:             0 kB

AnonPages:             0 kB

Mapped:                0 kB

Slab:               2984 kB

SReclaimable:       1900 kB

SUnreclaim:         1084 kB

PageTables:            0 kB

NFS_Unstable:          0 kB

Bounce:                0 kB

WritebackTmp:          0 kB

CommitLimit:       30156 kB

Committed_AS:          0 kB

VmallocTotal:          0 kB

VmallocUsed:           0 kB

VmallocChunk:          0 kB

 

 

-------- Slob ----------

 

root:/> cat /proc/meminfo

MemTotal:          60332 kB

MemFree:           47560 kB

Buffers:               0 kB

Cached:             7504 kB

SwapCached:            0 kB

Active:              616 kB

Inactive:           6836 kB

Active(anon):          0 kB

Inactive(anon):        0 kB

Active(file):        616 kB

Inactive(file):     6836 kB

Unevictable:           0 kB

Mlocked:               0 kB

MmapCopy:           2340 kB

SwapTotal:             0 kB

SwapFree:              0 kB

Dirty:                 0 kB

Writeback:             0 kB

AnonPages:             0 kB

Mapped:                0 kB

Slab:                  0 kB

SReclaimable:          0 kB

SUnreclaim:            0 kB

PageTables:            0 kB

NFS_Unstable:          0 kB

Bounce:                0 kB

WritebackTmp:          0 kB

CommitLimit:       30164 kB

Committed_AS:          0 kB

VmallocTotal:          0 kB

VmallocUsed:           0 kB

VmallocChunk:          0 kB

 

 

root:/> malloc-perf

00004k : 0x02ced004  000000 000000 000000

00008k : 0x02be6004  000000 000000 000000

00012k : 0x02c6c004  000000 000000 000000

00016k : 0x02bec004  000000 000000 000000

00020k : 0x02ae0004  000000 000000 000000

00024k : 0x02df0004  000000 000000 000000

00028k : 0x02df8004  000000 000000 000000

00032k : 0x02d70004  000000 000000 000000

00036k : 0x02d70004  000000 000031 004000

00040k : 0x02d70004  000000 000000 000000

00044k : 0x02d70004  000000 000062 004000

00048k : 0x02d70004  000000 000062 004000

00052k : 0x02d70004  000000 000000 000000

00056k : 0x02d70004  000000 000031 004000

00060k : 0x02d70004  000000 000000 000000

00064k : 0x02d70004  000000 000000 000000

00068k : 0x02a40004  000000 000062 004000

00072k : 0x02a40004  000000 000093 004000

00076k : 0x02a40004  000000 000000 000000

00080k : 0x02a40004  000000 000031 004000

00084k : 0x02a40004  000000 000062 004000

00088k : 0x02a40004  000000 000031 004000

00092k : 0x02a40004  000000 000031 004000

00096k : 0x02a40004  000000 000000 000000

00100k : 0x02a40004  000000 000031 004000

00104k : 0x02a40004  000000 000000 000000

00108k : 0x02a40004  000000 000062 004000

00112k : 0x02a40004  000000 000062 004000

00116k : 0x02a40004  000000 000031 004000

00120k : 0x02a40004  000000 000000 000000

00124k : 0x02a40004  000000 000062 004000

00128k : 0x02a40004  000000 000000 000000

00256k : 0x02a00004  000000 000000 000000

00384k : 0x02e00004  000000 000031 004000

00512k : 0x02e00004  000000 000062 004000

00640k : 0x02e00004  000000 000093 004000

00768k : 0x02e00004  000000 000000 000000

00896k : 0x02e00004  000000 000000 000000

01024k : 0x02e00004  000000 000031 004000

TEST PASS

 

 

root:/> cat /proc/meminfo

MemTotal:          60332 kB

MemFree:           47560 kB

Buffers:               0 kB

Cached:             7504 kB

SwapCached:            0 kB

Active:              636 kB

Inactive:           6816 kB

Active(anon):          0 kB

Inactive(anon):        0 kB

Active(file):        636 kB

Inactive(file):     6816 kB

Unevictable:           0 kB

Mlocked:               0 kB

MmapCopy:           2340 kB

SwapTotal:             0 kB

SwapFree:              0 kB

Dirty:                 0 kB

Writeback:             0 kB

AnonPages:             0 kB

Mapped:                0 kB

Slab:                  0 kB

SReclaimable:          0 kB

SUnreclaim:            0 kB

PageTables:            0 kB

NFS_Unstable:          0 kB

Bounce:                0 kB

WritebackTmp:          0 kB

CommitLimit:       30164 kB

Committed_AS:          0 kB

VmallocTotal:          0 kB

VmallocUsed:           0 kB

VmallocChunk:          0 kB

QuoteReplyEditDelete

 

 

2009-09-23 09:25:19     Re: about slab/slob memory footprint

Haitao Zhang (CHINA)

Message: 80308   

 

Sonic, thanks for the result.  looks very interesting.

 

slob will use less 364KB than slab in MemFree stat,

 

this is absoutely a good signal to prove it's footprint efficiency.

 

but seems there is a problem that cat /proc/meminfo in slob kernel didn't collect all the memory,

 

there is a item named "Slab" occupied about 2984KB in slab kernel (wow, it's big)

 

totally disappered in slob, but free memory only enlarged less than 500KB?

 

so where are those memory goes to exactly? kernel didn't record it in /proc/meminfo?

 

 

 

further than that i would also like to see the comparision with smaller system memory,

 

your last test result was collected from a system coming with 64MB memory.

 

so could you shrink it to a smaller value to simulate  a memory limited case,

 

like use MEM=5M or 6M as kernel bootup parameter?

 

then running a daemon like webserver or ftp server in the background

 

and collect free memory for kernel configured with both slab and slob.

TranslateQuoteReplyEditDelete

 

 

2009-09-25 00:47:18     Re: about slab/slob memory footprint

Sonic Zhang (CHINA)

Message: 80413   

 

Kernel can't boot up with MEM=5M because root fs also stays in RAM. The min memory size for default kernel config on bf548-ezkit is about 24M and free memory after kernel boots is about 6M. The Slab occupied memory info is just not displayed by slob driver. It is already indicated by memfree data and doesn't affect your analysis.

 

I have another data to compare memory status before and after jpgview is running on both slab and slob under 24M total memory.

 

 

 

------------ SLAB ---------------

 

root:/> cat proc/meminfo

MemTotal:          19636 kB

MemFree:            6436 kB

Buffers:               0 kB

Cached:             7596 kB

SwapCached:            0 kB

Active:              616 kB

Inactive:           6928 kB

Active(anon):          0 kB

Inactive(anon):        0 kB

Active(file):        616 kB

Inactive(file):     6928 kB

Unevictable:           0 kB

Mlocked:               0 kB

MmapCopy:           2340 kB

SwapTotal:             0 kB

SwapFree:              0 kB

Dirty:                 0 kB

Writeback:             0 kB

AnonPages:             0 kB

Mapped:                0 kB

Slab:               3000 kB

SReclaimable:       1900 kB

SUnreclaim:         1100 kB

PageTables:            0 kB

NFS_Unstable:          0 kB

Bounce:                0 kB

WritebackTmp:          0 kB

CommitLimit:        9816 kB

Committed_AS:          0 kB

VmallocTotal:          0 kB

VmallocUsed:           0 kB

VmallocChunk:          0 kB

 

 

root:/> jpegview 10250001.jpg &

480 272 480 272 0 0 24 0 95 54

framebase = 0x1601000 err=0

ImageWidth=362 ImageHeight=272

[1] 406 jpegview 10250001.jpg

root:/> read 10250001.jpg OK

 

root:/> cat proc/meminfo

MemTotal:          19636 kB

MemFree:            6240 kB

Buffers:               0 kB

Cached:             7596 kB

SwapCached:            0 kB

Active:              804 kB

Inactive:           6740 kB

Active(anon):          0 kB

Inactive(anon):        0 kB

Active(file):        804 kB

Inactive(file):     6740 kB

Unevictable:           0 kB

Mlocked:               0 kB

MmapCopy:           2540 kB

SwapTotal:             0 kB

SwapFree:              0 kB

Dirty:                 0 kB

Writeback:             0 kB

AnonPages:             0 kB

Mapped:                0 kB

Slab:               2988 kB

SReclaimable:       1900 kB

SUnreclaim:         1088 kB

PageTables:            0 kB

NFS_Unstable:          0 kB

Bounce:                0 kB

WritebackTmp:          0 kB

CommitLimit:        9816 kB

Committed_AS:          0 kB

VmallocTotal:          0 kB

VmallocUsed:           0 kB

VmallocChunk:          0 kB

 

 

------------ SLOB ---------------

 

root:/> cat proc/meminfo

MemTotal:          19652 kB

MemFree:            6808 kB

Buffers:               0 kB

Cached:             7584 kB

SwapCached:            0 kB

Active:              748 kB

Inactive:           6816 kB

Active(anon):          0 kB

Inactive(anon):        0 kB

Active(file):        748 kB

Inactive(file):     6816 kB

Unevictable:           0 kB

Mlocked:               0 kB

MmapCopy:           2340 kB

SwapTotal:             0 kB

SwapFree:              0 kB

Dirty:                 0 kB

Writeback:             0 kB

AnonPages:             0 kB

Mapped:                0 kB

Slab:                  0 kB

SReclaimable:          0 kB

SUnreclaim:            0 kB

PageTables:            0 kB

NFS_Unstable:          0 kB

Bounce:                0 kB

WritebackTmp:          0 kB

CommitLimit:        9824 kB

Committed_AS:          0 kB

VmallocTotal:          0 kB

VmallocUsed:           0 kB

VmallocChunk:          0 kB

 

 

root:/> jpegview 10250001.jpg &

480 272 480 272 0 0 24 0 95 54

framebase = 0x1601000 err=0

ImageWidth=362 ImageHeight=272

[1] 410 jpegview 10250001.jpg

root:/> read 10250001.jpg OK

 

root:/> cat proc/meminfo

MemTotal:          19652 kB

MemFree:            6596 kB

Buffers:               0 kB

Cached:             7584 kB

SwapCached:            0 kB

Active:              916 kB

Inactive:           6648 kB

Active(anon):          0 kB

Inactive(anon):        0 kB

Active(file):        916 kB

Inactive(file):     6648 kB

Unevictable:           0 kB

Mlocked:               0 kB

MmapCopy:           2540 kB

SwapTotal:             0 kB

SwapFree:              0 kB

Dirty:                 0 kB

Writeback:             0 kB

AnonPages:             0 kB

Mapped:                0 kB

Slab:                  0 kB

SReclaimable:          0 kB

SUnreclaim:            0 kB

PageTables:            0 kB

NFS_Unstable:          0 kB

Bounce:                0 kB

WritebackTmp:          0 kB

CommitLimit:        9824 kB

Committed_AS:          0 kB

VmallocTotal:          0 kB

VmallocUsed:           0 kB

VmallocChunk:          0 kB

Attachments

    Outcomes