From 37474e117c08a0c38dea53f603339b5914e9cd01 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Wed, 12 Jun 2019 13:28:03 -0400 Subject: [PATCH] limit precision for fragmentation in table --- README.md | 90 +++++++++++++++++++++++----------------------- calculate_waste.py | 2 +- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index bf8de30..80e601d 100644 --- a/README.md +++ b/README.md @@ -367,41 +367,41 @@ preliminary set of values. | size class | worst case internal fragmentation | slab slots | slab size | internal fragmentation for slabs | | - | - | - | - | - | | 16 | 93.75% | 256 | 4096 | 0.0% | -| 32 | 46.875% | 128 | 4096 | 0.0% | +| 32 | 46.88% | 128 | 4096 | 0.0% | | 48 | 31.25% | 85 | 4096 | 0.390625% | -| 64 | 23.4375% | 64 | 4096 | 0.0% | +| 64 | 23.44% | 64 | 4096 | 0.0% | | 80 | 18.75% | 51 | 4096 | 0.390625% | -| 96 | 15.625% | 42 | 4096 | 1.5625% | -| 112 | 13.392857142857139% | 36 | 4096 | 1.5625% | -| 128 | 11.71875% | 64 | 8192 | 0.0% | -| 160 | 19.375% | 51 | 8192 | 0.390625% | -| 192 | 16.145833333333343% | 64 | 12288 | 0.0% | -| 224 | 13.839285714285708% | 54 | 12288 | 1.5625% | -| 256 | 12.109375% | 64 | 16384 | 0.0% | -| 320 | 19.6875% | 64 | 20480 | 0.0% | -| 384 | 16.40625% | 64 | 24576 | 0.0% | -| 448 | 14.0625% | 64 | 28672 | 0.0% | -| 512 | 12.3046875% | 64 | 32768 | 0.0% | -| 640 | 19.84375% | 64 | 40960 | 0.0% | -| 768 | 16.536458333333343% | 64 | 49152 | 0.0% | -| 896 | 14.174107142857139% | 64 | 57344 | 0.0% | -| 1024 | 12.40234375% | 64 | 65536 | 0.0% | -| 1280 | 19.921875% | 16 | 20480 | 0.0% | -| 1536 | 16.6015625% | 16 | 24576 | 0.0% | -| 1792 | 14.229910714285708% | 16 | 28672 | 0.0% | -| 2048 | 12.451171875% | 16 | 32768 | 0.0% | -| 2560 | 19.9609375% | 8 | 20480 | 0.0% | -| 3072 | 16.634114583333343% | 8 | 24576 | 0.0% | -| 3584 | 14.2578125% | 8 | 28672 | 0.0% | -| 4096 | 12.4755859375% | 8 | 32768 | 0.0% | -| 5120 | 19.98046875% | 8 | 40960 | 0.0% | -| 6144 | 16.650390625% | 8 | 49152 | 0.0% | -| 7168 | 14.271763392857139% | 8 | 57344 | 0.0% | -| 8192 | 12.48779296875% | 8 | 65536 | 0.0% | -| 10240 | 19.990234375% | 6 | 61440 | 0.0% | -| 12288 | 16.658528645833343% | 5 | 61440 | 0.0% | -| 14336 | 14.278738839285708% | 4 | 57344 | 0.0% | -| 16384 | 12.493896484375% | 4 | 65536 | 0.0% | +| 96 | 15.62% | 42 | 4096 | 1.5625% | +| 112 | 13.39% | 36 | 4096 | 1.5625% | +| 128 | 11.72% | 64 | 8192 | 0.0% | +| 160 | 19.38% | 51 | 8192 | 0.390625% | +| 192 | 16.15% | 64 | 12288 | 0.0% | +| 224 | 13.84% | 54 | 12288 | 1.5625% | +| 256 | 12.11% | 64 | 16384 | 0.0% | +| 320 | 19.69% | 64 | 20480 | 0.0% | +| 384 | 16.41% | 64 | 24576 | 0.0% | +| 448 | 14.06% | 64 | 28672 | 0.0% | +| 512 | 12.3% | 64 | 32768 | 0.0% | +| 640 | 19.84% | 64 | 40960 | 0.0% | +| 768 | 16.54% | 64 | 49152 | 0.0% | +| 896 | 14.17% | 64 | 57344 | 0.0% | +| 1024 | 12.4% | 64 | 65536 | 0.0% | +| 1280 | 19.92% | 16 | 20480 | 0.0% | +| 1536 | 16.6% | 16 | 24576 | 0.0% | +| 1792 | 14.23% | 16 | 28672 | 0.0% | +| 2048 | 12.45% | 16 | 32768 | 0.0% | +| 2560 | 19.96% | 8 | 20480 | 0.0% | +| 3072 | 16.63% | 8 | 24576 | 0.0% | +| 3584 | 14.26% | 8 | 28672 | 0.0% | +| 4096 | 12.48% | 8 | 32768 | 0.0% | +| 5120 | 19.98% | 8 | 40960 | 0.0% | +| 6144 | 16.65% | 8 | 49152 | 0.0% | +| 7168 | 14.27% | 8 | 57344 | 0.0% | +| 8192 | 12.49% | 8 | 65536 | 0.0% | +| 10240 | 19.99% | 6 | 61440 | 0.0% | +| 12288 | 16.66% | 5 | 61440 | 0.0% | +| 14336 | 14.28% | 4 | 57344 | 0.0% | +| 16384 | 12.49% | 4 | 65536 | 0.0% | The slab allocation size classes end at 16384 since that's the final size for 2048 byte spacing and the next spacing class matches the page size of 4096 @@ -423,18 +423,18 @@ retaining the isolation. | size class | worst case internal fragmentation | slab slots | slab size | internal fragmentation for slabs | | - | - | - | - | - | -| 20480 | 19.9951171875% | 2 | 40960 | 0.0% | -| 24576 | 16.66259765625% | 2 | 49152 | 0.0% | -| 28672 | 14.2822265625% | 2 | 57344 | 0.0% | -| 32768 | 12.4969482421875% | 2 | 65536 | 0.0% | -| 40960 | 19.99755859375% | 1 | 40960 | 0.0% | -| 49152 | 16.664632161458343% | 1 | 49152 | 0.0% | -| 57344 | 14.283970424107139% | 1 | 57344 | 0.0% | -| 65536 | 12.49847412109375% | 1 | 65536 | 0.0% | -| 81920 | 19.998779296875% | 1 | 81920 | 0.0% | -| 98304 | 16.6656494140625% | 1 | 98304 | 0.0% | -| 114688 | 14.284842354910708% | 1 | 114688 | 0.0% | -| 131072 | 12.499237060546875% | 1 | 131072 | 0.0% | +| 20480 | 20.0% | 2 | 40960 | 0.0% | +| 24576 | 16.66% | 2 | 49152 | 0.0% | +| 28672 | 14.28% | 2 | 57344 | 0.0% | +| 32768 | 12.5% | 2 | 65536 | 0.0% | +| 40960 | 20.0% | 1 | 40960 | 0.0% | +| 49152 | 16.66% | 1 | 49152 | 0.0% | +| 57344 | 14.28% | 1 | 57344 | 0.0% | +| 65536 | 12.5% | 1 | 65536 | 0.0% | +| 81920 | 20.0% | 1 | 81920 | 0.0% | +| 98304 | 16.67% | 1 | 98304 | 0.0% | +| 114688 | 14.28% | 1 | 114688 | 0.0% | +| 131072 | 12.5% | 1 | 131072 | 0.0% | The `CONFIG_LARGE_SIZE_CLASSES` option controls whether large allocations use the same size class scheme providing 4 size classes for every doubling of size. diff --git a/calculate_waste.py b/calculate_waste.py index ced000a..ca26d9a 100755 --- a/calculate_waste.py +++ b/calculate_waste.py @@ -49,7 +49,7 @@ for size, slots, fragmentation in zip(size_classes, size_class_slots, fragmentat used = size * slots real = page_align(used) print("| ", end='') - print(size, str(fragmentation) + "%", slots, real, str(100 - used / real * 100) + "%", sep=" | ", end=" |\n") + print(size, f"{fragmentation:.4}%", slots, real, str(100 - used / real * 100) + "%", sep=" | ", end=" |\n") if len(argv) < 2: exit()