umtx: avoid umtxshm locking on object termination if possible

Sample build world result on tmpfs:
kern.ipc.umtx_terminate_notempty: 0
kern.ipc.umtx_terminate_empty: 2891815

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Mateusz Guzik 2018-12-08 14:04:57 +00:00
parent 9e53f3bd67
commit 6017827676
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=341727

View File

@ -3796,6 +3796,9 @@ umtx_shm_object_terminated(vm_object_t object)
struct umtx_shm_reg *reg, *reg1;
bool dofree;
if (LIST_EMPTY(USHM_OBJ_UMTX(object)))
return;
dofree = false;
mtx_lock(&umtx_shm_lock);
LIST_FOREACH_SAFE(reg, USHM_OBJ_UMTX(object), ushm_obj_link, reg1) {