blob: 78d92492fe695f659218fb05e067a83ee309e4df (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
--- sys/vm/vm_page.c.orig
+++ sys/vm/vm_page.c
@@ -4120,7 +4120,12 @@
if (nqueue == PQ_ACTIVE)
new.act_count = max(old.act_count, ACT_INIT);
if (old.queue == nqueue) {
- if (nqueue != PQ_ACTIVE)
+ /*
+ * There is no need to requeue pages already in the
+ * active queue.
+ */
+ if (nqueue != PQ_ACTIVE ||
+ (old.flags & PGA_ENQUEUED) == 0)
new.flags |= nflag;
} else {
new.flags |= nflag;
@@ -4217,7 +4222,8 @@
* referenced and avoid any queue operations.
*/
new.flags &= ~PGA_QUEUE_OP_MASK;
- if (nflag != PGA_REQUEUE_HEAD && old.queue == PQ_ACTIVE)
+ if (nflag != PGA_REQUEUE_HEAD && old.queue == PQ_ACTIVE &&
+ (old.flags & PGA_ENQUEUED) != 0)
new.flags |= PGA_REFERENCED;
else {
new.flags |= nflag;
|