Commit 8dbaca13 authored by Mike Gerdts's avatar Mike Gerdts Committed by Tomasz Zawadzki
Browse files

bdev: use spinlock instead of mutex



SPDK threads generally run on dedicated cores and locks should be rarely
contended. Thus, putting a thread to sleep while waiting on a mutex does
not free up CPU cycles for other pthreads or processes. Even when
running in interrupt mode, lock contention should be low enough that
spinlocks are a net win by avoiding context switches.

Signed-off-by: default avatarMike Gerdts <mgerdts@nvidia.com>
Change-Id: I6e2e78b2835bbadb56bbec34918d998d75280dfd
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15438


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 2be196c6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -489,8 +489,8 @@ struct spdk_bdev {
		/** True if the state of the QoS is being modified */
		bool qos_mod_in_progress;

		/** Mutex protecting claimed */
		pthread_mutex_t mutex;
		/** Spin lock protecting claimed */
		pthread_spinlock_t spinlock;

		/** The bdev status */
		enum spdk_bdev_status status;
+129 −123

File changed.

Preview size limit exceeded, changes collapsed.

+2 −2

File changed.

Preview size limit exceeded, changes collapsed.