]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
vm_reserv: Fix list locking in vm_reserv_reclaim_contig()
authorMark Johnston <markjdb@gmail.com>
Thu, 11 Mar 2021 15:34:28 +0000 (10:34 -0500)
committerMark Johnston <markj@FreeBSD.org>
Thu, 11 Mar 2021 15:35:35 +0000 (10:35 -0500)
commit968079f253c11433d47bece4b41b46fcbf985903
tree6887f6a2e1c171dd5923adcd8d3f75d7b8e15270
parent1645a4ae645fa9b9e3571b7512caa92e73b20635
vm_reserv: Fix list locking in vm_reserv_reclaim_contig()

The per-domain partpop queue is locked by the combination of the
per-domain lock and individual reservation mutexes.
vm_reserv_reclaim_contig() scans the queue looking for partially
populated reservations that can be reclaimed in order to satisfy the
caller's allocation.

During the scan, we drop the per-domain lock.  At this point, the rvn
pointer may be invalidated.  Take care to load rvn after re-acquiring
the per-domain lock.

While here, simplify the condition used to check whether a reservation
was dequeued while the per-domain lock was dropped.

Reviewed by: alc, kib
Reported by: gallatin
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29203
sys/vm/vm_reserv.c