Browse code

bb#3926

aCaB authored on 2012/01/17 19:21:00
Showing 5 changed files
... ...
@@ -1,3 +1,8 @@
1
+Tue Jan 17 11:15:57 CET 2012 (acab)
2
+-----------------------------------
3
+ * misc: performance improvement for HP-UX PA-RISC - patch from 
4
+	 Michael Pelletier <michael.v.pelletier*raytheon.com> (bb#3926)
5
+
1 6
 Fri Nov  4 00:52:21 CET 2011 (acab)
2 7
 -----------------------------------
3 8
  * libclamav/pe.c: parse vinfo where varfileinfo occours before stringfileinfo
... ...
@@ -35,6 +35,7 @@
35 35
 #include "others.h"
36 36
 #include "mpool.h"
37 37
 #include "server.h"
38
+#include "libclamav/others.h"
38 39
 
39 40
 #ifdef HAVE_MALLINFO
40 41
 #include <malloc.h>
... ...
@@ -467,7 +468,15 @@ threadpool_t *thrmgr_new(int max_threads, int idle_timeout, int max_queue, void
467 467
 #if defined(C_BIGSTACK)
468 468
 	pthread_attr_getstacksize(&(threadpool->pool_attr), &stacksize);
469 469
 	stacksize = stacksize + 64 * 1024;
470
-	if (stacksize < 1048576) stacksize = 1048576; /* at least 1MB please */
470
+	if (stacksize < 1048576) /* at least 1MB please */
471
+#if defined(C_HPUX) && defined(USE_MPOOL)
472
+		/* Set aside one cli_pagesize() for the stack's pthread header,
473
+		 * giving a 1M region to fit a 1M large-page */
474
+		if(cli_getpagesize() < 1048576)
475
+			stacksize = 1048576 - cli_getpagesize();
476
+		else
477
+#endif
478
+		stacksize = 1048576;
471 479
 	logg("Set stacksize to %lu\n", (unsigned long int) stacksize);
472 480
 	pthread_attr_setstacksize(&(threadpool->pool_attr), stacksize);
473 481
 #endif
... ...
@@ -16969,6 +16969,9 @@ hpux*)
16969 16969
 
16970 16970
 $as_echo "#define C_HPUX 1" >>confdefs.h
16971 16971
 
16972
+    if test "$have_mempool" = "yes"; then
16973
+	LDFLAGS="$LDFLAGS -Wl,+pd,1M"
16974
+    fi
16972 16975
     ;;
16973 16976
 aix*)
16974 16977
     if test "$have_pthreads" = "yes"; then
... ...
@@ -1070,6 +1070,9 @@ hpux*)
1070 1070
 	TH_SAFE="-thread-safe"
1071 1071
     fi
1072 1072
     AC_DEFINE([C_HPUX],1,[os is hpux])
1073
+    if test "$have_mempool" = "yes"; then
1074
+	LDFLAGS="$LDFLAGS -Wl,+pd,1M"
1075
+    fi
1073 1076
     ;;
1074 1077
 aix*)
1075 1078
     if test "$have_pthreads" = "yes"; then
... ...
@@ -64,7 +64,11 @@ static inline void spam(const char *fmt, ...) { fmt = fmt; } /* gcc STFU */
64 64
 
65 65
 #undef CL_DEBUG /* bb#2222 */
66 66
 
67
+#ifdef C_HPUX
68
+#define MIN_FRAGSIZE 1048576	/* Goes with LDFLAGS=-Wl,+pd,1M */
69
+#else
67 70
 #define MIN_FRAGSIZE 262144
71
+#endif
68 72
 
69 73
 #if SIZEOF_VOID_P==8
70 74
 static const unsigned int fragsz[] = {