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:
mjg 2018-12-08 14:04:57 +00:00
parent 43ef1e7712
commit d21951d547

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) {