PERFORCE change 17281 for review

Robert Watson rwatson at freebsd.org
Mon Sep 9 18:58:15 GMT 2002


http://people.freebsd.org/~peter/p4db/chv.cgi?CH=17281

Change 17281 by rwatson at rwatson_tislabs on 2002/09/09 11:57:59

	Remove local memory trashing support in malloc -- we added it
	when it disappeared in the UMA change, but UMA now does this
	natively so merge it back out.  Should marginally improve
	performance, and is a decent diff reduction.

Affected files ...

.. //depot/projects/trustedbsd/mac/sys/kern/kern_malloc.c#14 edit

Differences ...

==== //depot/projects/trustedbsd/mac/sys/kern/kern_malloc.c#14 (text+ko) ====

@@ -117,13 +117,6 @@
 	{0, NULL},
 };
 
-/*
- * The WEIRD_ADDR is used as known text to copy into free objects so
- * that modifications after frees can be detected.
- */
-#define	WEIRD_ADDR	0xdeadc0de
-#define	MAX_COPY	64
-
 u_int vm_kmem_size;
 
 /*
@@ -202,24 +195,6 @@
 }
 
 /*
- * Copy in known text to make the memory look free.
- */
-static __inline void
-trash_mem(void *addr, size_t size)
-{
-#ifdef INVARIANTS
-	uint32_t *ip;
-	
-	ip = (uint32_t *)addr;
-	size = size >= MAX_COPY ? MAX_COPY : size & ~sizeof(uint32_t);
-	while (size != 0) {
-		*ip++ = WEIRD_ADDR;
-		size -= sizeof(uint32_t);
-	}
-#endif
-}
-
-/*
  *	free:
  *
  *	Free a block of memory allocated by malloc.
@@ -255,7 +230,6 @@
 #ifdef INVARIANTS
 		struct malloc_type **mtp = addr;
 #endif
-		trash_mem(addr, size);
 		size = slab->us_zone->uz_size;
 #ifdef INVARIANTS
 		/*
@@ -275,7 +249,6 @@
 		uma_zfree_arg(slab->us_zone, addr, slab);
 	} else {
 		size = slab->us_size;
-		trash_mem(addr, size);
 		uma_large_free(slab);
 	}
 	mtx_lock(&ksp->ks_mtx);
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list