From b86e6ec007b0588faa7da2de902a9c8588927769 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sat, 30 Oct 2004 23:30:53 +0000 Subject: [PATCH] During traversal of the active queue by vm_pageout_page_stats(), try locking the page's containing object before accessing the page's flags. --- sys/vm/vm_pageout.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c index 9018a735222..3d21c1f5b44 100644 --- a/sys/vm/vm_pageout.c +++ b/sys/vm/vm_pageout.c @@ -1241,6 +1241,7 @@ vm_pageout_scan(int pass) static void vm_pageout_page_stats() { + vm_object_t object; vm_page_t m,next; int pcount,tpcount; /* Number of pages to check */ static int fullintervalcount = 0; @@ -1272,12 +1273,20 @@ vm_pageout_page_stats() ("vm_pageout_page_stats: page %p isn't active", m)); next = TAILQ_NEXT(m, pageq); + object = m->object; + if (!VM_OBJECT_TRYLOCK(object)) { + vm_pageq_requeue(m); + m = next; + continue; + } + /* * Don't deactivate pages that are busy. */ if ((m->busy != 0) || (m->flags & PG_BUSY) || (m->hold_count != 0)) { + VM_OBJECT_UNLOCK(object); vm_pageq_requeue(m); m = next; continue; @@ -1313,7 +1322,7 @@ vm_pageout_page_stats() vm_pageq_requeue(m); } } - + VM_OBJECT_UNLOCK(object); m = next; } } -- 2.45.2