Re: [patch 09/10] Remove the SLOB allocator for 2.6.23

From: Pekka Enberg
Date: Mon Jul 09 2007 - 08:47:35 EST


Hi Nick,

Pekka Enberg wrote:
> I assume with "slab external fragmentation" you mean allocating a
> whole page for a slab when there are not enough objects to fill the
> whole thing thus wasting memory?

On 7/9/07, Nick Piggin <nickpiggin@xxxxxxxxxxxx> wrote:
Yep. Without really analysing it, I guess SLOB's savings here are
O(1) over SLUB and will relatively diminish as the machine size gets
larger, however with the number of slabs even a small kernel creates,
this is likely to be significant on small memory systems.

Running the included script on my little Debian on UML with 32 MB of
RAM shows anywhere from 20 KB up to 100 KB of wasted space on light
load. What's interesting is that the wasted amount seems to stabilize
around 70 KB and never goes below that.

Pekka

#!/bin/bash

total_wasted=0

for i in $(find /sys/slab -type d -mindepth 1 -maxdepth 1 | sort)
do
nr_objs=$(cat $i/objects)
slabs=$(cat $i/slabs)
objs_per_slab=$(cat $i/objs_per_slab)
let "max_objs=$objs_per_slab*$slabs"

object_size=$(cat $i/object_size)
let "wasted=($max_objs-$nr_objs)*$object_size"

if [ "$wasted" -ne "0" ]; then
echo "$i: max_objs=$max_objs, nr_objs=$nr_objs, $wasted bytes wasted"
fi
let "total_wasted=$total_wasted+$wasted"
done

echo "Total wasted: $total_wasted"
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/