bug in vm_contig.c? [was: Re: ACPI crash with recent changes]

Alan L. Cox alc at imimic.com
Thu Mar 4 19:28:57 PST 2004


Please test the attached patch instead.  In order to avoid a race 
condition, it is necessary for the loop to begin with "start" rather 
than "start + 1".  What is both unnecessary and wrong is the physical 
contiguity check.  (My bad. :-()  In other words, the test that the page 
is still free must be repeated because of the dropping of the free page 
queue lock, but contiguity once true is always true.

Regards,
Alan

-------------- next part --------------
Index: vm/vm_contig.c
===================================================================
RCS file: /home/ncvs/src/sys/vm/vm_contig.c,v
retrieving revision 1.31
diff -u -r1.31 vm_contig.c
--- vm/vm_contig.c	2 Mar 2004 08:25:58 -0000	1.31
+++ vm/vm_contig.c	5 Mar 2004 03:08:17 -0000
@@ -232,9 +232,7 @@
 		mtx_lock_spin(&vm_page_queue_free_mtx);
 		for (i = start; i < (start + size / PAGE_SIZE); i++) {
 			pqtype = pga[i].queue - pga[i].pc;
-			if ((VM_PAGE_TO_PHYS(&pga[i]) !=
-			    (VM_PAGE_TO_PHYS(&pga[i - 1]) + PAGE_SIZE)) ||
-			    (pqtype != PQ_FREE)) {
+			if (pqtype != PQ_FREE) {
 				start++;
 				goto again;
 			}


More information about the freebsd-current mailing list