amd64: Check that pages freed to the zeroed-pages queue are really zeroed.
authorJordan Gordeev <jgordeev@dir.bg>
Tue, 26 May 2009 05:51:14 +0000 (08:51 +0300)
committerJordan Gordeev <jgordeev@dir.bg>
Wed, 27 May 2009 11:25:04 +0000 (14:25 +0300)
sys/vm/vm_page.h

index b0405c6..cfe94cd 100644 (file)
 #include <sys/thread2.h>
 #endif
 
+#ifdef __amd64__
+#include <machine/vmparam.h>
+#endif
+
 #endif
 
 typedef enum vm_page_event { VMEVENT_NONE, VMEVENT_COW } vm_page_event_t;
@@ -604,6 +608,18 @@ vm_page_free(vm_page_t m)
 static __inline void
 vm_page_free_zero(vm_page_t m)
 {
+#ifdef __amd64__
+       /* JG DEBUG64 We check if the page is really zeroed. */
+       char *p = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m));
+       int i;
+
+       for (i = 0; i < PAGE_SIZE; i++) {
+               if (p[i] != 0) {
+                       panic("non-zero page in vm_page_free_zero()");
+               }
+       }
+
+#endif
        vm_page_flag_set(m, PG_ZERO);
        vm_page_free_toq(m);
 }