]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
vm_reserv: Fix list locking in vm_reserv_reclaim_contig()
authorMark Johnston <markjdb@gmail.com>
Sun, 14 Mar 2021 16:39:23 +0000 (12:39 -0400)
committerMark Johnston <markj@FreeBSD.org>
Sun, 14 Mar 2021 16:39:23 +0000 (12:39 -0400)
commit45910f663893fab38eaf95c70aaeff75035334c1
tree492048d7d716c99f80930c439b3b592a58d03804
parente6e8762dff593cbd1da4cc5a3b8f75b183c23837
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.

Approved by: re (gjb)
Reviewed by: alc, kib
Reported by: gallatin
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29203

(cherry picked from commit 968079f253c11433d47bece4b41b46fcbf985903)
(cherry picked from commit cec3990d347972c30558b135b1bc9954184fb5fe)
sys/vm/vm_reserv.c