]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Dequeue wired pages lazily.
authorMark Johnston <markj@FreeBSD.org>
Wed, 7 Feb 2018 16:57:10 +0000 (16:57 +0000)
committerMark Johnston <markj@FreeBSD.org>
Wed, 7 Feb 2018 16:57:10 +0000 (16:57 +0000)
commit1d3a1bcfac7f16129a4920d0be880a50797281bc
tree341de1f7336830ec17cbc1d73deccdebe0d82505
parent207efdb3454c3d8fc9c34499f1a9d4a80179ccd9
Dequeue wired pages lazily.

Previously, wiring a page would cause it to be removed from its page
queue. In the common case, unwiring causes it to be enqueued at the tail
of that page queue. This change modifies vm_page_wire() to not dequeue
the page, thus avoiding the highly contended page queue locks. Instead,
vm_page_unwire() takes care of requeuing the page as a single operation,
and the page daemon dequeues wired pages as they are encountered during
a queue scan to avoid needlessly revisiting them later. For pages in
PQ_ACTIVE we do even better, since a requeue is unnecessary.

The change improves scalability for some common workloads. For instance,
threads wiring pages into the buffer cache no longer need to modify
global page queues, and unwiring is usually done by the bufspace thread,
so concurrency is not as much of an issue. As another example, many
sysctl handlers wire the output buffer to avoid faults on copyout, and
since the buffer is likely to be in PQ_ACTIVE, we now entirely avoid
modifying the page queue in this case.

The change also adds a block comment describing some properties of
struct vm_page's reference counters, and the busy lock.

Reviewed by: jeff
Discussed with: alc, kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D11943
sys/kern/kern_sendfile.c
sys/kern/vfs_bio.c
sys/vm/vm_object.c
sys/vm/vm_page.c
sys/vm/vm_page.h
sys/vm/vm_pageout.c
sys/vm/vm_swapout.c