Mercurial > hg > release > icedtea6-1.13
changeset 2259:ddbf2447886c
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.
* 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 | Fri, 17 Sep 2010 17:36:07 +0100 |
parents | 2713dbdb914e |
children | f9af7b6a08eb |
files | ChangeLog Makefile.am patches/numa_on_early_glibc.patch |
diffstat | 3 files changed, 56 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Sep 17 10:07:45 2010 -0400 +++ b/ChangeLog Fri Sep 17 17:36:07 2010 +0100 @@ -1,3 +1,11 @@ +2010-09-17 Andrew John Hughes <ahughes@redhat.com> + + * Makefile.am: + Add new patch. + * 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-17 Omair Majid <omajid@redhat.com> * Makefile.am: Only create man pages for javaws if ENABLE_DOCS is set
--- a/Makefile.am Fri Sep 17 10:07:45 2010 -0400 +++ b/Makefile.am Fri Sep 17 17:36:07 2010 +0100 @@ -297,7 +297,8 @@ patches/openjdk/6969395-net_bugs.patch \ patches/openjdk/6510892-httpserver_test.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 += \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/numa_on_early_glibc.patch Fri Sep 17 17:36:07 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) {