[or-cvs] r14059: Backport to 0.2.0 branch: Use 8k pages in openbsd malloc cod (in tor/branches/tor-0_2_0-patches: . src/common)

nickm at seul.org nickm at seul.org
Mon Mar 17 02:48:20 UTC 2008


Author: nickm
Date: 2008-03-16 22:48:18 -0400 (Sun, 16 Mar 2008)
New Revision: 14059

Modified:
   tor/branches/tor-0_2_0-patches/
   tor/branches/tor-0_2_0-patches/ChangeLog
   tor/branches/tor-0_2_0-patches/src/common/OpenBSD_malloc_Linux.c
Log:
 r18851 at catbus:  nickm | 2008-03-16 22:35:48 -0400
 Backport to 0.2.0 branch: Use 8k pages in openbsd malloc code on alpha. Bug and solution found by weasel.  Also, when initializing openbsd malloc code, check that compiled page size matches output of getpagesize().



Property changes on: tor/branches/tor-0_2_0-patches
___________________________________________________________________
 svk:merge ticket from /tor/020 [r18851] on 8246c3cf-6607-4228-993b-4d95d33730f1

Modified: tor/branches/tor-0_2_0-patches/ChangeLog
===================================================================
--- tor/branches/tor-0_2_0-patches/ChangeLog	2008-03-17 02:48:17 UTC (rev 14058)
+++ tor/branches/tor-0_2_0-patches/ChangeLog	2008-03-17 02:48:18 UTC (rev 14059)
@@ -27,6 +27,10 @@
     - Use proper log levels in the testsuite call of get_interface_address6().
     - When using a nonstandard malloc, do not use the platform values for
       HAVE_MALLOC_GOOD_SIZE or HAVE_MALLOC_USABLE_SIZE.
+    - Make the openbsd malloc code use 8k pages on alpha CPUs.  Bugfix on
+      0.2.0.x.
+    - Detect mismatched page sizes when using --enable-openbsd-malloc.
+      Bugfix on 0.2.0.x.
 
 
 Changes in version 0.2.0.21-rc - 2008-03-02

Modified: tor/branches/tor-0_2_0-patches/src/common/OpenBSD_malloc_Linux.c
===================================================================
--- tor/branches/tor-0_2_0-patches/src/common/OpenBSD_malloc_Linux.c	2008-03-17 02:48:17 UTC (rev 14058)
+++ tor/branches/tor-0_2_0-patches/src/common/OpenBSD_malloc_Linux.c	2008-03-17 02:48:18 UTC (rev 14059)
@@ -95,7 +95,7 @@
 #define _MALLOC_LOCK() {pthread_mutex_lock(&gen_mutex);}
 #define _MALLOC_UNLOCK() {pthread_mutex_unlock(&gen_mutex);}
 
-#if defined(__sparc__)
+#if defined(__sparc__) || defined(__alpha__)
 #define	malloc_pageshift	13U
 #endif /* __sparc__ */
 
@@ -786,6 +786,13 @@
 		    "  Will not be able to dump malloc stats on exit");
 #endif /* MALLOC_STATS */
 
+	if (malloc_pagesize != getpagesize()) {
+		wrterror("malloc() replacement compiled with a different "
+			 "page size from what we're running with.  Failing.");
+		errno = ENOMEM;
+		return;
+	}
+
 	/* Allocate one page for the page directory. */
 	page_dir = (struct pginfo **)MMAP(malloc_pagesize);
 



More information about the tor-commits mailing list