changeset 2089:43a38e678ae4

Support systems where the sched_getcpu libc call is not present but the syscall is. 2010-09-17 Andrew John Hughes <ahughes@redhat.com> * Makefile.am: Add new patch. * NEWS: Updated. * patches/numa_on_early_glibc.patch, Fallback to making a syscall if sched_getcpu exists but the glibc used is too old to support it.
author Andrew John Hughes <ahughes@redhat.com>
date Mon, 04 Oct 2010 17:01:26 +0100
parents fb2449018b34
children 0aff588d7af9
files ChangeLog Makefile.am NEWS patches/numa_on_early_glibc.patch
diffstat 4 files changed, 61 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Sep 29 13:37:46 2010 -0700
+++ b/ChangeLog	Mon Oct 04 17:01:26 2010 +0100
@@ -1,5 +1,14 @@
+2010-09-17  Andrew John Hughes  <ahughes@redhat.com>
+
+	* Makefile.am:
+	Add new patch.
+	* NEWS: Updated.
+	* patches/numa_on_early_glibc.patch,
+	Fallback to making a syscall if sched_getcpu
+	exists but the glibc used is too old to support it.
+
 2010-09-29  Deepak Bhole <dbhole@redhat.com>
-	
+
 	Fixed PR519 (patch from dnietoc@gmail.com).
 	* plugin/icedteanp/IcedTeaNPPlugin.cc: Have ITNP_NewStream return
 	NPERR_GENERIC_ERROR instead of NPERR_NO_ERROR.
--- a/Makefile.am	Wed Sep 29 13:37:46 2010 -0700
+++ b/Makefile.am	Mon Oct 04 17:01:26 2010 +0100
@@ -334,7 +334,8 @@
 	patches/fonts-rhel.patch \
 	patches/icedtea-too-many-args.patch \
 	patches/openjdk/6638712-wildcard_types.patch \
-	patches/openjdk/6650759-missing_inference.patch
+	patches/openjdk/6650759-missing_inference.patch \
+	patches/numa_on_early_glibc.patch
 
 if WITH_RHINO
 ICEDTEA_PATCHES += \
--- a/NEWS	Wed Sep 29 13:37:46 2010 -0700
+++ b/NEWS	Mon Oct 04 17:01:26 2010 +0100
@@ -4,11 +4,13 @@
   - G244901: Skip test_gamma on hardened (PaX-enabled) kernels
   - G266295: Provide font configuration for Gentoo.
   - Provide font configuration for RHEL 6.
+  - RH633510: OpenJDK should use NUMA even if glibc doesn't provide it
+* Backports:
   - S6951319: enable solaris builds using Sun Studio 12 update 1 (fixes PR398)
   - S6539464, RH500077: Ensure java.lang.Math functions provide consistent results.
   - S6638712: Inference with wildcard types causes selection of inapplicable method
   - S6650759: Inference of formal type parameter (unused in formal parameters) is not performed
-- NetX:
+* NetX:
   - Fix browser command in BasicService.showDocument(URL)
   - Run programs that inherit main(String[]) in their main-class
   - Run JNLP files that use 1.6 as the spec version
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/numa_on_early_glibc.patch	Mon Oct 04 17:01:26 2010 +0100
@@ -0,0 +1,46 @@
+--- openjdk.orig/hotspot/src/os/linux/vm/os_linux.cpp	2010-09-14 15:30:59.000000000 +0100
++++ openjdk/hotspot/src/os/linux/vm/os_linux.cpp	2010-09-14 17:45:54.000000000 +0100
+@@ -54,6 +54,10 @@ 
+ # include <sys/shm.h>
+ # include <link.h>
+ 
++#if __x86_64__
++#include <asm/vsyscall.h>
++#endif
++
+ #define MAX_PATH    (2 * K)
+ 
+ // for timer info max values which include all bits
+@@ -2414,6 +2418,21 @@ 
+   return end;
+ }
+ 
++static int sched_getcpu_syscall(void) {
++  unsigned int cpu;
++  int retval = -1;
++
++#if __x86_64__
++  typedef long (*vgetcpu_t)(unsigned int *cpu, unsigned int *node, unsigned long *tcache);
++  vgetcpu_t vgetcpu = (vgetcpu_t)VSYSCALL_ADDR(__NR_vgetcpu);
++  retval = vgetcpu(&cpu, NULL, NULL);
++#elif __i386__
++  retval = syscall(SYS_getcpu, &cpu, NULL, NULL);
++#endif
++
++  return (retval == -1) ? retval : cpu;
++}
++
+ extern "C" void numa_warn(int number, char *where, ...) { }
+ extern "C" void numa_error(char *where) { }
+ 
+@@ -2422,6 +2441,10 @@ 
+   set_sched_getcpu(CAST_TO_FN_PTR(sched_getcpu_func_t,
+                                   dlsym(RTLD_DEFAULT, "sched_getcpu")));
+ 
++  // If it's not, try a direct syscall.
++  if (sched_getcpu() == -1)
++    set_sched_getcpu(CAST_TO_FN_PTR(sched_getcpu_func_t, (void*)&sched_getcpu_syscall));
++
+   if (sched_getcpu() != -1) { // Does it work?
+     void *handle = dlopen("libnuma.so.1", RTLD_LAZY);
+     if (handle != NULL) {