]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit - sys/vm/vm_page.h
vm_page_xbusy_claim(): Use atomics to update busy lock state.
authorMark Johnston <markj@FreeBSD.org>
Tue, 28 Jul 2020 19:50:39 +0000 (19:50 +0000)
committerMark Johnston <markj@FreeBSD.org>
Tue, 28 Jul 2020 19:50:39 +0000 (19:50 +0000)
commitf72e5be58adce556812ecec568bd480759f15969
treebcdb0a1ac79e58ee1e0b260ce53445972ccf7d0a
parentb027b6637a7d7bf97868bba37a43e53fcee5c222
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