+20
−7
Loading
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. Reviewed-by:Suren Baghdasaryan <surenb@google.com> Reviewed-by:
Harry Yoo <harry.yoo@oracle.com> Signed-off-by:
Vlastimil Babka <vbabka@suse.cz>