On Tuesday 18 September 2007 03:17:14 pm Kris Kennaway
wrote:
> Kurt Miller wrote:
> > David Xu confirmed for me that pthread_yield()
does give some
> > time to lower priority threads on 7.0 using thr.
Attached and inline
> > are two patches for the 1.5 port that is how I
suggest the issue be
> > addressed.
> >
> > For 7.0 and up default UseThreadPriorities to true
and always
> > use pthread_yield(). For < 7.0 default
UseThreadPriorities to
> > false and conditionally use
pthread_yield()/os_sleep(). User's
> > can toggle UseThreadPriorities with the command
line argument
> > -XX:+UseThreadPriorities
>
> Do we know that 6.x requires the old behaviour? Maybe
it can default to
> on there too. Otherwise this looks good to my eyeball
(but the
> DEFAULT_LD_LIBRARY_PATH change looks unrelated)
>
> -#define DEFAULT_LD_LIBRARY_PATH "/usr/lib"
/* See ld.so.1(1) */
> +#define DEFAULT_LD_LIBRARY_PATH
"/usr/lib:/usr/local/lib" /* See
> ld.so.1(1)
Yea I messed up the DEFAULT_LD_LIBRARY_PATH part. I didn't
intend
to change that segment of the existing os_bsd.cpp patch.
Regarding 6.x it either needs UseThreadPriorities defaulted
to false
or the os_sleep hack. After discussing the options with
Daniel we
agree that defaulting UseThreadPriorities to false and
eliminating
the os_sleep hack for all versions is the most consitant
approach.
The following is a CVS diff of ports/java/jdk15 that updates
the
port to fix the performance issue plus an alternative
method
to setting DEFAULT_LD_LIBRARY_PATH without patching and
substituting it:
Index: Makefile
============================================================
=======
RCS file: /home/ncvs/ports/java/jdk15/Makefile,v
retrieving revision 1.135
diff -u -r1.135 Makefile
--- Makefile 7 Sep 2007 20:41:52 -0000 1.135
+++ Makefile 19 Sep 2007 01:53:17 -0000
 -7,7
+7,7 
PORTNAME= jdk
PORTVERSION= $.$p${JDK_PAT
CHSET_VERSION}
-PORTREVISION= 1
+PORTREVISION= 2
PORTEPOCH= 1
CATEGORIES= java devel
MASTER_SITES= # http://download.java.
net/tiger/
 -129,6
+129,7 
MAKE_ENV+= ALT_BOOTDIR="$"
ALT_MOTIF_DIR="$"
+ DEFAULT_LD_LIBRARY_PATH="/usr/lib:$/lib&q
uot;
SYS_CFLAGS="$"
LANG="C"
JAVA_HOME=""
 -161,7
+162,6 
JDKIMAGEDIR= $/../build/bsd-$/j2sdk-im
age
JDKIMAGEDIR_G= $/../build/bsd-$/j2sdk-
debug-image
-LOCAL_FILES= ../../hotspot/src/os/bsd/vm/os_bsd.cpp
PTHREAD_FILES= ../../hotspot/build/bsd/makefiles/vm.make
../../j2se/make/com/sun/java/pack/Makefile
../../j2se/make/common/Defs.gmk
 -265,10
+265,6 
.endif
post-patch:
- for file in $; do
- $ -e
"s:%%LOCALBASE%%:$:"
- $/$$;
- done
for file in $; do
$ -e
"s:-pthread:$:g"
$/$$;
Index: files/patch-vm::globals.hpp
============================================================
=======
RCS file: files/patch-vm::globals.hpp
diff -N files/patch-vm::globals.hpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ files/patch-vm::globals.hpp 19 Sep 2007 01:53:17 -0000
 -0,0
+1,26 
+$FreeBSD$
+
+--- ../../hotspot/src/share/vm/runtime/globals.hpp.orig Wed
May 2 04:01:50
2007
++++ ../../hotspot/src/share/vm/runtime/globals.hpp Tue Sep
18 21:40:44 2007
+ -130,6 +130,12 
+ #define falseInProduct true
+ #endif
+
++#if defined(_ALLBSD_SOURCE)
++#define OSUseThreadPriorities false
++#else
++#define OSUseThreadPriorities true
++#endif
++
+ // develop flags are settable / visible only during
development and are
constant in the PRODUCT version
+ // product flags are always settable / visible
+
+ -2546,7 +2552,7 
+ "beginning to throw OutOfMemoryErrors in
each compile")
+
+ /* Priorities */
+- product(bool, UseThreadPriorities, true,
++ product(bool, UseThreadPriorities,
OSUseThreadPriorities,
+ "Use native thread priorities")
+
+ product(intx, ThreadPriorityPolicy, 0,
Index: files/patch-vm::os_bsd.cpp
============================================================
=======
RCS file:
/home/ncvs/ports/java/jdk15/files/patch-vm::os_bsd.cpp,v
retrieving revision 1.7
diff -u -r1.7 patch-vm::os_bsd.cpp
--- files/patch-vm::os_bsd.cpp 9 Jun 2007 05:14:56
-0000 1.7
+++ files/patch-vm::os_bsd.cpp 19 Sep 2007 01:53:17 -0000
 -1,13
+1,32 
$FreeBSD: ports/java/jdk15/files/patch-vm::os_bsd.cpp,v 1.7
2007/06/09
05:14:56 glewis Exp $
---- ../../hotspot/src/os/bsd/vm/os_bsd.cpp Sun Jun 3
18:46:31 2007
-+++ ../../hotspot/src/os/bsd/vm/os_bsd.cpp.orig Sun Jun 3
18:47:28 2007
- -499,7 +499,7 
- #define getenv(n) ::getenv(n)
+--- ../../hotspot/src/os/bsd/vm/os_bsd.cpp.orig Mon Sep 17
21:03:04 2007
++++ ../../hotspot/src/os/bsd/vm/os_bsd.cpp Tue Sep 18
21:36:51 2007
+ -2271,13 +2271,7 
+ if (thread->is_Java_thread()) {
+ ThreadBlockInVM tbivm((JavaThread*) thread);
+
+-// BSDXXX: Only use pthread_yield here and below if the
system thread
+-// scheduler gives time slices to lower priority threads
when yielding.
+-#ifdef __FreeBSD__
+- os_sleep(MinSleepInterval, interruptible);
+-#else
+ pthread_yield();
+-#endif
+
+ #if SOLARIS
+ // XXX - This code was not exercised during the
Merlin RC1
+ -2297,13 +2291,7 
+ return 0;
+ }
+
+-// BSDXXX: Only use pthread_yield here and above if the
system thread
+-// scheduler gives time slices to lower priority threads
when yielding.
+-#ifdef __FreeBSD__
+- os_sleep(MinSleepInterval, interruptible);
+-#else
+ pthread_yield();
+-#endif
+ return 0;
+ }
- #ifndef DEFAULT_LD_LIBRARY_PATH
--#define DEFAULT_LD_LIBRARY_PATH "/usr/lib" /*
See ld.so.1(1) */
-+#define DEFAULT_LD_LIBRARY_PATH
"/usr/lib:%%LOCALBASE%%/lib" /* See ld.so.1
(1) */
- #endif
- #define EXTENSIONS_DIR "/lib/ext"
- #define ENDORSED_DIR "/lib/endorsed"
_______________________________________________
freebsd-performance freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-p
erformance
To unsubscribe, send any mail to
"freebsd-performance-unsubscribe freebsd.org"
|