-
Andrew Morton authored
From: Manfred Spraul <manfred@colorfullife.com> slab.c is not very efficient for passing objects between cpus. Usually this is a rare event, but with network routing and cpu-affine NICs it is possible that nearly all allocation operations will occur on one cpu, and nearly all free operations on another cpu. This causes slab memory to be returned to slab's free page list rather than being cached on behalf of the particular slab cache. The attached patch solves that by adding an array of objects that is shared by all cpus. Instead of multiple linked list operations per object, object pointers are now passed to/from the shared array (and thus between cpus) with memcopy operations. On uniprocessor, the default array size is 0, because the shared array and the per-cpu head array are redundant. Additionally, the patch exports more statistics in /proc/slabinfo and make the array sizes tunable by writing to /proc/slabinfo. Both changes break backward compatibility, user space scripts must look at the slabinfo version and act accordingly. The size of the new shared array may be altered at runtime, by writing to /proc/slabinfo. The new parameters for writing to /proc/slabinfo are: #echo "cache-name limit batchcount shared" > /proc/slabinfo For example "size-4096 120 60 8" improves the slab efficiency for network routing, because the default values (24 12 8) are too small for the large series generated due to irq mitigation. Note that only root has write permissions to /proc/slabinfo. These changes provided an overall 12% speedup in Robert Olson's gigE packet-formwarding testing on 2-way.
dd6b3d93