Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/dbinc/lock.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ struct __db_lock { /* SHARED */
MUTEX_UNLOCK(env, (region)->mtx_dd)
#define LOCK_LOCKERS(env, region) \
MUTEX_LOCK(env, (region)->mtx_lockers)
#define RDLOCK_LOCKERS(env, region) \
MUTEX_READLOCK(env, (region)->mtx_lockers)
#define UNLOCK_LOCKERS(env, region) \
MUTEX_UNLOCK(env, (region)->mtx_lockers)

Expand Down
2 changes: 1 addition & 1 deletion src/lock/lock.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ __lock_get_api(env, locker, flags, obj, lock_mode, lock)

region = env->lk_handle->reginfo.primary;

LOCK_LOCKERS(env, region);
RDLOCK_LOCKERS(env, region);
ret = __lock_getlocker_int(env->lk_handle, locker, 0, &sh_locker);
UNLOCK_LOCKERS(env, region);
LOCK_SYSTEM_LOCK(env->lk_handle, region);
Expand Down
10 changes: 9 additions & 1 deletion src/lock/lock_region.c
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,16 @@ __lock_region_init(env, lt)
env, MTX_LOCK_REGION, 0, &region->mtx_dd)) != 0)
return (ret);

/*
* The locker mutex is a SHARED latch: the hot lock-get path looks up
* an existing locker (a read-only hash walk) and takes it shared, so
* many cores can resolve their locker concurrently; locker create,
* free, the deadlock detector's locker-list walk, failchk, and stat
* take it exclusive. This removes the per-operation global
* serialization on lock_get/lock_put.
*/
if ((ret = __mutex_alloc(
env, MTX_LOCK_REGION, 0, &region->mtx_lockers)) != 0)
env, MTX_LOCK_REGION, DB_MUTEX_SHARED, &region->mtx_lockers)) != 0)
return (ret);

/* Allocate room for the locker hash table and initialize it. */
Expand Down
Loading