Memory Fragmentation Experiments
Baseline measurements
Baseline measurements of free memory on the system
- Raw free - Total amount of memory (pre page allocator, primitive memory manager)
- 425828352 bytes
- Machine booted
- Statistical variation
- 399835136, 399577088, 399634432, 400617472 (fresh reboots)
- Seems to be a slight increase in the short time period after the system is read for login. Some processes finishing?
- 399835136, 399577088, 399634432, 400617472 (fresh reboots)
- Idle (~0.5hr)
- 401162240, 401166336, 401166336, 401166336
- Statistical variation
- Baseline user level (eg logged in)
- 392515584
Controlled Experiments
Program which uses a known amount of memory (20%-80%)
- Measure amount of memory free and fragmentation before and after test has run
Before Test Run |
392515584 |
20% (After Run 1) |
392445952 |
20% (After Run 2) |
392425472 |
20% (After Run 3) |
392429568 |
20% (After Run 10) |
392155136 |
20% (After Run 20) |
392159232 |
20% (After Run 100) |
391585792 |
80% (After Run 100) |
391364608 |
80% (After Run 300) |
390508544 |
80% (After Run 1000) |
388276224 |
Notes:
- The test program is very simple - it does a printf, malloc, sleeps for a couple of seconds and then exits
- Experiments with 80% system memory allocation were done after rebooting the system
- There appears to be a small memory leak evertime the program is run. These numbers were generated with the PMLeafChunk class enabled and set to an allocation of 128k. However I reran the experiment (just with user and after 1000 runs) and verified there was a drop in free memory in the page allocator.
Free memory available after multiple runs of /home/regress/sysinit
After first run |
Second run |
Third Run |
Fourth Run |
Tenth Run |
367964160 |
356360192 |
345309184 |
337707008 |
268816384 |
- The page allocator has about 10Mb less memory free after each invocation of the regress
- lost in the FCM's?
Action |
Memory available in page allocator |
Logged in to fresh system |
393125888 |
dd /dev/zero to bigfile (10Mb) (nfs) |
381894656 |
dd bigfile to /dev/null |
381063168 |
dd bigfile to bigfile2 (nfs) |
370249728 |
rm bigfile bigfile2 |
389791744 |
logout, login |
384000000 |
dd /dev/zero to bigfile (20Mb) (nfs) |
363102208 |
rm bigfile2 |
383586304 |
Benchmark that consumes a large percentage of system memory with a mix of long/short lived processes
SDET performance with difference chunk allocation sizes
Tests were run on k4. SDET numbers are average over single runSdet run(eg 24 runs)
Configuration |
SDET Result |
Performance loss/gain |
Chunk allocation disabled 1 CPU |
774.73 |
Reference |
Chunk allocation disabled 4 CPU |
3019.07 |
Reference |
512kb Chunks 1 CPU |
769.85 |
-0.63% |
512kb Chunks 4 CPU |
3005.1 |
-0.46% |
512Kb Chunks 1 CPU (Chunk freeing) |
770.53 |
-0.54% |
512kb chunks 4 CPU (Chunk freeing) |
3010.79 |
-0.27% |
Fragmentation after running K42 and linux regress tests
The following histogram displays the fragmentation of memory after running /home/regress/sysinit (eg k42 and linux regress tests without SDET). The 4k run was with the PMLeafChunk allocation disabled.
- I suspect something may be wrong with the implementation because I did not expect the fragmentation levels to begin increasing again after dropping initially (after 256kb chunk allocations).
- Significant fragmentation is occurring from other sources (eg file access)
Raw data is here: memory_frag_pmleafchunk_raw.txt
The table below displays the amount of memory free (table entry) which is available in contiguous size (row) versus the allocation size used by PMLeafChunk
|
|
Allocation Size |
||||
|
|
4k |
128k |
256k |
512k |
1024k |
Memory free in contiguous pages >= size |
4k |
89931 |
88789 |
89131 |
88287 |
87239 |
128k |
84569 |
85286 |
85405 |
84756 |
83833 |
|
256k |
83379 |
84927 |
84630 |
83661 |
82812 |
|
512k |
82012 |
84613 |
84072 |
83257 |
82729 |
|
1Mb |
79052 |
84485 |
83608 |
83257 |
82293 |
|
Notes
The 4k row shows how much memory is free (as seen by the PageAllocator). It is smaller with higher chunk allocation sizes because processes still running at the end of the test run are consuming more memory at higher allocation sizes.
