]> Zhao Yanbai Git Server - minix.git/commitdiff
vm: junkfree feature that fills freed pages with a recognizable pattern.
authorBen Gras <ben@minix3.org>
Tue, 8 Jun 2010 00:59:48 +0000 (00:59 +0000)
committerBen Gras <ben@minix3.org>
Tue, 8 Jun 2010 00:59:48 +0000 (00:59 +0000)
servers/vm/alloc.c
servers/vm/vm.h

index 9782d9ec6cdc10097e73d65e653e3207e0ab84e7..b4b82745ea9f067eacc110ff0fe1010b529a98d9 100644 (file)
@@ -540,6 +540,12 @@ PRIVATE void free_pages(phys_bytes pageno, int npages)
 
        assert(!addr_search(&addravl, pageno, AVL_EQUAL));
 
+#if JUNKFREE
+       if(sys_memset(0xa5a5a5a5, VM_PAGE_SIZE * pageno,
+               VM_PAGE_SIZE * npages) != OK)
+                       panic("free_pages: sys_memset failed");
+#endif
+
        /* try to merge with higher neighbour */
        if((pr=addr_search(&addravl, pageno+npages, AVL_EQUAL))) {
                USE(pr, pr->addr -= npages;
index 0a20d6ee4b89a3a68bfec8c4534d1ac0dcda7c86..f3d9b57220a69da16c9caca2388a243a9f99b5da 100644 (file)
@@ -20,6 +20,7 @@
 /* Compile in asserts and custom sanity checks at all? */
 #define SANITYCHECKS   0
 #define VMSTATS                0
+#define JUNKFREE       0       /* Fill freed pages with junk */
 
 /* How noisy are we supposed to be? */
 #define VERBOSE                0