]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit - sys/vm/vm_page.h
vm_page_xbusy_claim(): Use atomics to update busy lock state.
authormarkj <markj@FreeBSD.org>
Tue, 28 Jul 2020 19:50:39 +0000 (19:50 +0000)
committermarkj <markj@FreeBSD.org>
Tue, 28 Jul 2020 19:50:39 +0000 (19:50 +0000)
commit5d5ab891a3db333604e317f3396564222842dd2c
treebcdb0a1ac79e58ee1e0b260ce53445972ccf7d0a
parent52ad572e63193776b1d0fa412ae0f458a9c2ba5c
vm_page_xbusy_claim(): Use atomics to update busy lock state.

vm_page_xbusy_claim() could clobber the waiter bit.  For its original
use, kernel memory pages, this was not a problem since nothing would
ever block on the busy lock for such pages.  r363607 introduced a new
use where this could in principle be a problem.

Fix the problem by using atomic_cmpset to update the lock owner.  Since
this macro is defined only for INVARIANTS kernels the extra overhead
doesn't seem prohibitive.

Reported by: vangyzen
Reviewed by: alc, kib, vangyzen
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25859
sys/vm/vm_page.h