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
 Sun Jan  8 19:26:06 CET 2012 (acab)
2 7
 -----------------------------------
3 8
  * libclamav: add preliminary support for MS Authenticode signatures,
... ...
@@ -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
... ...
@@ -17684,6 +17684,9 @@ hpux*)
17684 17684
 
17685 17685
 $as_echo "#define C_HPUX 1" >>confdefs.h
17686 17686
 
17687
+    if test "$have_mempool" = "yes"; then
17688
+	LDFLAGS="$LDFLAGS -Wl,+pd,1M"
17689
+    fi
17687 17690
     ;;
17688 17691
 aix*)
17689 17692
     if test "$have_pthreads" = "yes"; then
... ...
@@ -1035,6 +1035,9 @@ hpux*)
1035 1035
 	TH_SAFE="-thread-safe"
1036 1036
     fi
1037 1037
     AC_DEFINE([C_HPUX],1,[os is hpux])
1038
+    if test "$have_mempool" = "yes"; then
1039
+	LDFLAGS="$LDFLAGS -Wl,+pd,1M"
1040
+    fi
1038 1041
     ;;
1039 1042
 aix*)
1040 1043
     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[] = {