diff options
| author | Steven Rostedt <[email protected]> | 2006-02-01 03:05:45 -0800 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2006-02-01 08:53:17 -0800 |
| commit | fbaccacff1f17c65ae0972085368a7ec75be6062 (patch) | |
| tree | a559ee27ac259f7a48c036ec8eba94a04748c25e /scripts | |
| parent | 5ec8a847bb8ae2ba6395cfb7cb4bfdc78ada82ed (diff) | |
[PATCH] slab: cache_estimate cleanup
Clean up cache_estimate() in mm/slab.c and improves the algorithm from O(n) to
O(1). We first calculate the maximum number of objects a slab can hold after
struct slab and kmem_bufctl_t for each object has been given enough space.
After that, to respect alignment rules, we decrease the number of objects if
necessary. As required padding is at most align-1 and memory of obj_size is
at least align, it is always enough to decrease number of objects by one.
The optimization was originally made by Balbir Singh with more improvements
from Steven Rostedt. Manfred Spraul provider further modifications: no loop
at all for the off-slab case and added comments to explain the background.
Acked-by: Balbir Singh <[email protected]>
Signed-off-by: Manfred Spraul <[email protected]>
Signed-off-by: Steven Rostedt <[email protected]>
Signed-off-by: Pekka Enberg <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions