]> www.infradead.org Git - users/hch/misc.git/commit
debugobjects: Implement batch processing
authorThomas Gleixner <tglx@linutronix.de>
Mon, 7 Oct 2024 16:50:17 +0000 (18:50 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 15 Oct 2024 15:30:33 +0000 (17:30 +0200)
commitf57ebb92ba3e09a7e1082f147d6e1456d702d4b2
tree955c40bbc20e1a9801fb82933f8d12b77c3137b5
parentaebbfe0779b271c099cc80c5e2995c2087b28dcf
debugobjects: Implement batch processing

Adding and removing single objects in a loop is bad in terms of lock
contention and cache line accesses.

To implement batching, record the last object in a batch in the object
itself. This is trivialy possible as hlists are strictly stacks. At a batch
boundary, when the first object is added to the list the object stores a
pointer to itself in debug_obj::batch_last. When the next object is added
to the list then the batch_last pointer is retrieved from the first object
in the list and stored in the to be added one.

That means for batch processing the first object always has a pointer to
the last object in a batch, which allows to move batches in a cache line
efficient way and reduces the lock held time.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Zhen Lei <thunder.leizhen@huawei.com>
Link: https://lore.kernel.org/all/20241007164914.258995000@linutronix.de
lib/debugobjects.c