debugobjects: Rework object handling
Status from this message: The following commit has been merged into the core/debugobjects branch of tip:
Get series with b4
b4 am [email protected]Versions newest first
Patches in v1 Applied
Reviews trailers per patch
19 of 25 patches have a Reviewed-by or Acked-by.
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [patch 00/25] debugobjects: Rework object handling
Zhen reported that the global lock in debug objects is problematic. There are several issues:
1) Parallel pool refill attempts result in long wait times
2) The operations under the lock move batches of objects by moving them one by one from one list to another
This takes quite some time and is also a cache line dirtying festival.
For further context see:
https://lore.kernel.org/all/[email protected]
https://lore.kernel.org/all/[email protected]
Address this with the following changes:
1) Avoid parallel pool refills unless the fill level is critical
2) Release and reacquire the pool look between batches in the worker thread.
3) Convert the pool handling to a stack of batches which can be moved with trivial hlist operations which are fast and do not touch a gazillion of cache lines
While working on this, I noticed that the kmem_cache allocation/free rate is rather high. This is addressed by:
1) Doubling the per CPU pool size
2) Agressively refilling the per CPU pool from the free list
3) Throttling the kmem_cache_free() operations by monitoring the object usage with a exponentially wheighed moving average
The resulting reduction for a full kernel compile:
kmem_cache_alloc() kmem_cache_free()
Base: 380k 330k
#1: 295k 245k #2: 225k 245k #3: 170k 117k
Especially the reduction of allocations makes a difference as that happens in the hot path.
There are further possibilities to enhance this:
1) Move the lock into the new global pool data structure
2) Provide a per-node "global" pool which is brought up before the first CPU of a node is brought up
That's left as an exercise for the reader. :)
The series has incorporated the latest changes from Zhen:
https://lore.kernel.org/all/[email protected]
to avoid conflicts.
It is based on v6.12-rc1 and also available from git:
git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git core/debugobjects
Thanks,
tglx
--- include/linux/debugobjects.h | 12 lib/debugobjects.c | 866 ++++++++++++++++++++++++------------------- 2 files changed, 503 insertions(+), 375 deletions(-)