[PATCH] slab: reap timers
- add a reap timer that returns stale objects from the cpu arrays - use list_for_each instead of while loops - /proc/slabinfo layout change, for a new field about reaping. Implementation: slab contains 2 caches that contain objects that might be usable to the systems: - the cpu arrays contains objects that other cpus could use - the slabs_free list contains freeable slabs, i.e. pages that someone else might want. The patch now keeps track of accesses to the cpu arrays and to the free list. If there were no recent activities in one of the caches, part of the cache is flushed. Unlike <2.5.39, only a small part (~20%) is flushed each time: The older kernel would refill/drain bounce heavily under memory pressure: - kmem_cache_alloc: notices that there are no objects in the cpu cache, loads 120 objects from the slab lists, return 1. [assuming batchcount=120] - kmem_cache_reap is called due to memory pressure, finds 119 objects in the cpu array and returns them to the slab lists. - repeat. In addition, the length of the free list is limited based on the free list accesses: a fixed "1" limit hurts the large object caches. That's the last part for now, next is: [not yet written] - cleanup: BUG_ON instead of if() BUG - OOM handling for enable_cpucaches - remove the unconditional might_sleep() from cache_alloc_debugcheck_before, and make that DEBUG dependant. - initial NUMA support, just to collect some stats: Which percentage of the objects are freed on the wrong node? 0.1% or 20%?
Showing
This diff is collapsed.
Please register or sign in to comment