From a15f7df5deb5861348e8eff04f60cecf5942f595 Mon Sep 17 00:00:00 2001 From: Attilio Rao Date: Mon, 8 Apr 2013 20:02:27 +0000 Subject: [PATCH] The per-page act_count can be made very-easily protected by the per-page lock rather than vm_object lock, without any further overhead. Make the formal switch. Sponsored by: EMC / Isilon storage division Reviewed by: alc Tested by: pho --- sys/vm/vm_page.h | 2 +- sys/vm/vm_pageout.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index d2393dc4ddd3..e24096160469 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -143,7 +143,7 @@ struct vm_page { uint8_t aflags; /* access is atomic */ uint8_t oflags; /* page VPO_* flags (O) */ uint16_t flags; /* page PG_* flags (P) */ - u_char act_count; /* page usage count (O) */ + u_char act_count; /* page usage count (P) */ u_char busy; /* page busy count (O) */ /* NOTE that these must support one bit per DEV_BSIZE in a page!!! */ /* so, on normal X86 kernels, they must be at least 8 bits wide */ diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index c0a0da465bb3..3934348766d4 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -1015,9 +1015,9 @@ vm_pageout_scan(int pass) } else if ((m->aflags & PGA_REFERENCED) == 0 && (actcount = pmap_ts_referenced(m)) != 0) { vm_page_activate(m); - vm_page_unlock(m); - m->act_count += actcount + ACT_ADVANCE; VM_OBJECT_WUNLOCK(object); + m->act_count += actcount + ACT_ADVANCE; + vm_page_unlock(m); goto relock_queues; } @@ -1031,9 +1031,9 @@ vm_pageout_scan(int pass) vm_page_aflag_clear(m, PGA_REFERENCED); actcount = pmap_ts_referenced(m); vm_page_activate(m); - vm_page_unlock(m); - m->act_count += actcount + ACT_ADVANCE + 1; VM_OBJECT_WUNLOCK(object); + m->act_count += actcount + ACT_ADVANCE + 1; + vm_page_unlock(m); goto relock_queues; }