Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Sep 2002 11:58:15 -0700 (PDT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 17281 for review
Message-ID:  <200209091858.g89IwFPQ076990@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=17281

Change 17281 by rwatson@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@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209091858.g89IwFPQ076990>