]> www.infradead.org Git - users/jedix/linux-maple.git/commit
slab: determine barn status racily outside of lock
authorVlastimil Babka <vbabka@suse.cz>
Thu, 13 Feb 2025 11:50:34 +0000 (12:50 +0100)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 4 Mar 2025 16:35:05 +0000 (11:35 -0500)
commitca0418fb4604b79d216d199dd99ca86fca504116
tree7f63a8f642329b2b1d6c870195845e4627f459d3
parent8b30cf3a6494a32ac3fa5c685bee739329a7a1b7
slab: determine barn status racily outside of lock

The possibility of many barn operations is determined by the current
number of full or empty sheaves. Taking the barn->lock just to find out
that e.g. there are no empty sheaves results in unnecessary overhead and
lock contention. Thus perform these checks outside of the lock with a
data_race() annotated variable read and fail quickly without taking the
lock.

Checks for sheaf availability that racily succeed have to be obviously
repeated under the lock for correctness, but we can skip repeating
checks if there are too many sheaves on the given list as the limits
don't need to be strict.

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
mm/slub.c