40 lines
1.5 KiB
Diff
40 lines
1.5 KiB
Diff
From f195a65829b168efddad9cbe41b6154c4483005f Mon Sep 17 00:00:00 2001
|
|
From: "jeffery.wsj" <jeffery.wsj@alibaba-inc.com>
|
|
Date: Fri, 10 Jul 2020 08:31:42 +0000
|
|
Subject: [PATCH] Xhook SYS_getcpu vdso call
|
|
|
|
---
|
|
src/hotspot/os/linux/os_linux.cpp | 16 +++++++++-------
|
|
1 file changed, 9 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp
|
|
index dbf18b7b5f..59a2ef3ab6 100644
|
|
--- a/src/hotspot/os/linux/os_linux.cpp
|
|
+++ b/src/hotspot/os/linux/os_linux.cpp
|
|
@@ -2876,13 +2876,15 @@ int os::Linux::sched_getcpu_syscall(void) {
|
|
#elif defined(AMD64)
|
|
// Unfortunately we have to bring all these macros here from vsyscall.h
|
|
// to be able to compile on old linuxes.
|
|
- #define __NR_vgetcpu 2
|
|
- #define VSYSCALL_START (-10UL << 20)
|
|
- #define VSYSCALL_SIZE 1024
|
|
- #define VSYSCALL_ADDR(vsyscall_nr) (VSYSCALL_START+VSYSCALL_SIZE*(vsyscall_nr))
|
|
- 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);
|
|
+// #define __NR_vgetcpu 2
|
|
+// #define VSYSCALL_START (-10UL << 20)
|
|
+// #define VSYSCALL_SIZE 1024
|
|
+// #define VSYSCALL_ADDR(vsyscall_nr) (VSYSCALL_START+VSYSCALL_SIZE*(vsyscall_nr))
|
|
+// 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);
|
|
+ cpu = get_nprocs();
|
|
+ retval = 0;
|
|
#endif
|
|
|
|
return (retval == -1) ? retval : cpu;
|
|
--
|
|
2.17.1
|
|
|