]> 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)
committerVlastimil Babka <vbabka@suse.cz>
Wed, 11 Jun 2025 14:03:38 +0000 (16:03 +0200)
commitfe63891759bd330f6ecede427fbb77697d190ac2
tree0973c52057c561143dfab2760b9b77b6b21703ff
parent119a8b1ac0abe9ab0cc5ef5324f6da35906fabda
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>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
mm/slub.c