]> www.infradead.org Git - users/jedix/linux-maple.git/commit
slab: determine barn status racily outside of lock
authorVlastimil Babka <vbabka@suse.cz>
Fri, 14 Feb 2025 16:27:43 +0000 (17:27 +0100)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Mon, 3 Mar 2025 18:43:51 +0000 (13:43 -0500)
commitf6033f6b83e33a88b073539ffc22012c8e48bc06
tree83ceab06b39440d99daa2afe2eaa54e144ddceee
parent583d638bfc807a35725faafe11a4cd4699a4c90e
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