Lines Matching refs:Linux

131 julong os::Linux::_physical_memory = 0;
133 address os::Linux::_initial_thread_stack_bottom = NULL;
134 uintptr_t os::Linux::_initial_thread_stack_size = 0;
136 int (*os::Linux::_clock_gettime)(clockid_t, struct timespec *) = NULL;
137 int (*os::Linux::_pthread_getcpuclockid)(pthread_t, clockid_t *) = NULL;
138 Mutex* os::Linux::_createThread_lock = NULL;
139 pthread_t os::Linux::_main_thread;
140 int os::Linux::_page_size = -1;
141 const int os::Linux::_vm_default_page_size = (8 * K);
142 bool os::Linux::_is_floating_stack = false;
143 bool os::Linux::_is_NPTL = false;
144 bool os::Linux::_supports_fast_thread_cpu_time = false;
145 const char * os::Linux::_glibc_version = NULL;
146 const char * os::Linux::_libpthread_version = NULL;
189 char* name() const { return (char*)"Linux MemNotify Thread"; }
205 return Linux::available_memory();
208 julong os::Linux::available_memory() {
217 return Linux::physical_memory();
308 pid_t os::Linux::gettid() {
325 "environment on Linux when /proc filesystem is not mounted.";
327 void os::Linux::initialize_system_info() {
330 pid_t pid = os::Linux::gettid();
442 * on legacy Linux implementations (which are no longer supported).
527 bool os::Linux::is_sig_ignored(int sig) {
538 void os::Linux::signal_sets_init() {
563 if (!os::Linux::is_sig_ignored(SHUTDOWN1_SIGNAL)) {
567 if (!os::Linux::is_sig_ignored(SHUTDOWN2_SIGNAL)) {
571 if (!os::Linux::is_sig_ignored(SHUTDOWN3_SIGNAL)) {
586 sigset_t* os::Linux::unblocked_signals() {
593 sigset_t* os::Linux::vm_signals() {
599 sigset_t* os::Linux::allowdebug_blocked_signals() {
604 void os::Linux::hotspot_sigmask(Thread* thread) {
613 pthread_sigmask(SIG_UNBLOCK, os::Linux::unblocked_signals(), NULL);
629 void os::Linux::libpthread_init() {
645 os::Linux::set_glibc_version(str);
651 os::Linux::set_glibc_version(_gnu_libc_version);
664 if (strcmp(os::Linux::glibc_version(), "glibc 2.3.2") == 0 &&
668 os::Linux::set_libpthread_version("linuxthreads");
670 os::Linux::set_libpthread_version(str);
674 os::Linux::set_libpthread_version("linuxthreads");
678 os::Linux::set_is_NPTL();
680 os::Linux::set_is_LinuxThreads();
685 if (os::Linux::is_NPTL() || os::Linux::supports_variable_stack_size()) {
686 os::Linux::set_is_floating_stack();
693 // Force Linux kernel to expand current thread stack. If "bottom" is close
700 // when creating a new thread. Linux kernel will automatically expand thread
708 // Linux kernel does not expand stack, instead a SIGSEGV is sent to the
709 // application (see Linux kernel fault.c).
711 // This Linux feature can cause SIGSEGV when VM bangs thread stack for
720 // To get around the problem and allow stack banging on Linux, we need to
736 // page to force a page fault. Linux kernel will then automatically expand the
757 bottom = (address)align_size_down((uintptr_t)bottom, os::Linux::page_size());
758 bottom += os::Linux::page_size() - 1;
774 bool os::Linux::manually_expand_stack(JavaThread * t, address addr) {
797 if (os::Linux::is_LinuxThreads() && !os::Linux::is_floating_stack()) {
798 // Fixed stack LinuxThreads (SuSE Linux/x86, and some versions of Redhat)
858 osthread->set_thread_id(os::Linux::gettid());
867 os::Linux::hotspot_sigmask(thread);
870 os::Linux::init_thread_fpu_state();
915 if (os::Linux::supports_variable_stack_size()) {
918 stack_size = os::Linux::default_stack_size(thr_type);
942 stack_size = MAX2(stack_size, os::Linux::min_stack_allowed);
949 pthread_attr_setguardsize(&attr, os::Linux::default_guard_size(thr_type));
955 bool lock = os::Linux::is_LinuxThreads() && !os::Linux::is_floating_stack();
957 os::Linux::createThread_lock()->lock_without_safepoint_check();
972 if (lock) os::Linux::createThread_lock()->unlock();
989 os::Linux::createThread_lock()->unlock();
1011 assert(os::Linux::_main_thread == pthread_self(), "should be called inside main thread");
1028 osthread->set_thread_id(os::Linux::gettid());
1032 os::Linux::init_thread_fpu_state();
1046 if (os::Linux::is_initial_thread()) {
1053 // enabling yellow zone first will crash JVM on SuSE Linux), so there
1062 os::Linux::manually_expand_stack(jt, addr);
1068 os::Linux::hotspot_sigmask(thread);
1081 // Free Linux resources related to the OSThread
1124 bool os::Linux::is_initial_thread(void) {
1163 // is needed because pthread_getattr_np() on most (all?) Linux distros returns
1165 void os::Linux::capture_initial_stack(size_t max_size) {
1199 // Linux kernel saves start_stack information in /proc/<pid>/stat. Similar
1317 // FreeBSD with a Linux emulator, or inside chroot), this should work for
1402 void os::Linux::clock_init() {
1452 void os::Linux::fast_thread_clock_init() {
1480 if (Linux::supports_monotonic_clock()) {
1482 int status = Linux::clock_gettime(CLOCK_MONOTONIC, &tp);
1496 if (Linux::supports_monotonic_clock()) {
1628 // of getpid(2). Linux provides no api that returns the pid
1826 // Remember the stack's state. The Linux dynamic linker will change
1828 bool os::Linux::_stack_is_executable = false;
1845 _lib = os::Linux::dll_load_in_vmthread(_filename, _ebuf, _ebuflen);
1846 os::Linux::_stack_is_executable = true;
1860 // See Linux man page execstack(8) for more info.
1861 if (os::uses_stack_guard_pages() && !os::Linux::_stack_is_executable) {
1865 os::Linux::_stack_is_executable = true;
1893 result = os::Linux::dlopen_helper(filename, ebuf, ebuflen);
1911 result = os::Linux::dlopen_helper(filename, ebuf, ebuflen);
2062 void * os::Linux::dlopen_helper(const char *filename, char *ebuf, int ebuflen) {
2071 void * os::Linux::dll_load_in_vmthread(const char *filename, char *ebuf, int ebuflen) {
2137 pid_t pid = os::Linux::gettid();
2147 os::Linux::print_distro_info(st);
2151 os::Linux::print_libversion_info(st);
2158 os::Linux::print_distro_info(st);
2168 os::Linux::print_libversion_info(st);
2174 os::Linux::print_full_memory_info(st);
2178 // Most Linux distributions have /etc/XXX-release file, which contains
2182 void os::Linux::print_distro_info(outputStream* st) {
2192 st->print("Linux");
2197 void os::Linux::print_libversion_info(outputStream* st) {
2200 st->print(os::Linux::glibc_version()); st->print(" ");
2201 st->print(os::Linux::libpthread_version()); st->print(" ");
2202 if (os::Linux::is_LinuxThreads()) {
2203 st->print("(%s stack)", os::Linux::is_floating_stack() ? "floating" : "fixed");
2208 void os::Linux::print_full_memory_info(outputStream* st) {
2529 // Linux(POSIX) specific hand shaking semaphore.
2597 assert(os::Linux::page_size() != -1, "must call os::init");
2598 return os::Linux::page_size();
2603 assert(os::Linux::page_size() != -1, "must call os::init");
2604 return os::Linux::page_size();
2646 // Linux man page that documents this specific set of errno
2681 // NOTE: Linux kernel does not really reserve the pages for us.
2685 int os::Linux::commit_memory_impl(char* addr, size_t size, bool exec) {
2707 return os::Linux::commit_memory_impl(addr, size, exec) == 0;
2713 int err = os::Linux::commit_memory_impl(addr, size, exec);
2731 int os::Linux::commit_memory_impl(char* addr, size_t size,
2751 // happens with large pages on Linux or that we cannot recover
2761 err = os::Linux::commit_memory_impl(addr, size, exec);
2770 return os::Linux::commit_memory_impl(addr, size, alignment_hint, exec) == 0;
2777 int err = os::Linux::commit_memory_impl(addr, size, alignment_hint, exec);
2805 Linux::numa_interleave_memory(addr, bytes);
2809 Linux::numa_tonode_memory(addr, bytes, lgrp_hint);
2815 int max_node = Linux::numa_max_node();
2820 int cpu_id = Linux::sched_getcpu();
2822 int lgrp_id = Linux::get_node_by_cpu(cpu_id);
2846 int os::Linux::sched_getcpu_syscall(void) {
2880 void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
2888 bool os::Linux::libnuma_init() {
2926 void os::Linux::rebuild_cpu_to_node_map() {
2962 int os::Linux::get_node_by_cpu(int cpu_id) {
2969 GrowableArray<int>* os::Linux::_cpu_to_node;
2970 os::Linux::sched_getcpu_func_t os::Linux::_sched_getcpu;
2971 os::Linux::numa_node_to_cpus_func_t os::Linux::_numa_node_to_cpus;
2972 os::Linux::numa_max_node_func_t os::Linux::_numa_max_node;
2973 os::Linux::numa_available_func_t os::Linux::_numa_available;
2974 os::Linux::numa_tonode_memory_func_t os::Linux::_numa_tonode_memory;
2975 os::Linux::numa_interleave_memory_func_t os::Linux::_numa_interleave_memory;
2976 unsigned long* os::Linux::_numa_all_nodes;
2984 // Linux uses a growable mapping for the stack, and if the mapping for
2988 // that point, the Linux kernel cannot expand the stack any further
3045 bool chk_bounds = NOT_DEBUG(os::Linux::is_initial_thread()) DEBUG_ONLY(true);
3047 assert(os::Linux::is_initial_thread(),
3061 bool chk_bounds = NOT_DEBUG(os::Linux::is_initial_thread()) DEBUG_ONLY(true);
3063 assert(os::Linux::is_initial_thread(),
3078 // may not start from the requested address. Unlike Linux mmap(), this
3086 assert((uintptr_t)requested_addr % os::Linux::page_size() == 0, "unaligned address");
3130 // Linux wants the mprotect address argument to be page aligned.
3131 char* bottom = (char*)align_size_down((intptr_t)addr, os::Linux::page_size());
3140 size = align_size_up(pointer_delta(addr, bottom, 1) + size, os::Linux::page_size());
3168 bool os::Linux::hugetlbfs_sanity_check(bool warn, size_t page_size) {
3266 // large_page_size on Linux is used to round up heap size. x86 uses either
3309 const size_t default_page_size = (size_t)Linux::page_size();
3316 Linux::hugetlbfs_sanity_check(warn_on_failure, _large_page_size);
3356 // Note 1: different Linux may use different name for this property,
3452 // Linux mmap allows caller to pass an address as hint; give it a try first,
3542 assert(!Linux::supports_monotonic_clock(), "time moving backwards");
3581 assert(!Linux::supports_monotonic_clock(), "time moving backwards");
3620 // Threads on Linux are all with same priority. The Solaris style
3633 // Note: Normal Linux applications are run with SCHED_OTHER policy. SCHED_OTHER
3635 // applications, Linux supports SCHED_RR which allows static priority (1-99).
3674 warning("-XX:ThreadPriorityPolicy requires root privilege on Linux");
3831 // supported Linux platforms). Note that LinuxThreads need to block
3841 os::Linux::set_our_sigflags(SR_signum, act.sa_flags);
4011 bool os::Linux::signal_handlers_are_installed = false;
4014 struct sigaction os::Linux::sigact[MAXSIGNUM];
4015 unsigned int os::Linux::sigs = 0;
4016 bool os::Linux::libjsig_is_loaded = false;
4018 get_signal_t os::Linux::get_signal_action = NULL;
4020 struct sigaction* os::Linux::get_chained_signal_action(int sig) {
4080 bool os::Linux::chained_handler(int sig, siginfo_t* siginfo, void* context) {
4092 struct sigaction* os::Linux::get_preinstalled_handler(int sig) {
4099 void os::Linux::save_preinstalled_handler(int sig, struct sigaction& oldAct) {
4106 int os::Linux::sigflags[MAXSIGNUM];
4108 int os::Linux::get_our_sigflags(int sig) {
4113 void os::Linux::set_our_sigflags(int sig, int flags) {
4118 void os::Linux::set_signal_handler(int sig, bool set_installed) {
4168 void os::Linux::install_signal_handlers() {
4223 // This is the fastest way to get thread cpu time on Linux.
4230 jlong os::Linux::fast_thread_cpu_time(clockid_t clockid) {
4232 int rc = os::Linux::clock_gettime(clockid, &tp);
4239 // glibc on Linux platform uses non-documented flag
4305 if((int)sa.sa_flags != os::Linux::get_our_sigflags(sig)) {
4308 os::Linux::get_our_sigflags(sig));
4317 os::Linux::check_signal_handler(sig)
4355 void os::Linux::check_signal_handler(int sig) {
4413 } else if(os::Linux::get_our_sigflags(sig) != 0 && (int)act.sa_flags != os::Linux::get_our_sigflags(sig)) {
4415 tty->print("expected:" PTR32_FORMAT, os::Linux::get_our_sigflags(sig));
4450 // So, on Linux, the launcher thread pid is passed to the VM
4464 Linux::set_page_size(sysconf(_SC_PAGESIZE));
4465 if (Linux::page_size() == -1) {
4469 init_page_sizes((size_t) Linux::page_size());
4471 Linux::initialize_system_info();
4474 Linux::_main_thread = pthread_self();
4476 Linux::clock_init();
4483 if (vm_page_size() > (int)Linux::vm_default_page_size()) {
4486 StackShadowPages = round_to((StackShadowPages*Linux::vm_default_page_size()), vm_page_size()) / vm_page_size();
4500 Linux::fast_thread_clock_init();
4503 address polling_page = (address) ::mmap(NULL, Linux::page_size(), PROT_READ, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
4514 address mem_serialize_page = (address) ::mmap(NULL, Linux::page_size(), PROT_READ | PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
4532 Linux::signal_sets_init();
4533 Linux::install_signal_handlers();
4540 os::Linux::min_stack_allowed = MAX2(os::Linux::min_stack_allowed,
4541 (size_t)(StackYellowPages+StackRedPages+StackShadowPages) * Linux::page_size() +
4542 (2*BytesPerWord COMPILER2_PRESENT(+1)) * Linux::vm_default_page_size());
4546 threadStackSizeInBytes < os::Linux::min_stack_allowed) {
4549 os::Linux::min_stack_allowed/ K);
4558 Linux::capture_initial_stack(JavaThread::stack_size_at_create());
4560 Linux::libpthread_init();
4563 Linux::glibc_version(), Linux::libpthread_version(),
4564 Linux::is_floating_stack() ? "floating stack" : "fixed stack");
4568 if (!Linux::libnuma_init()) {
4571 if ((Linux::numa_max_node() < 1)) {
4617 Linux::set_createThread_lock(new Mutex(Mutex::leaf, "createThread_lock", false));
4658 if( !guard_memory((char*)_polling_page, Linux::page_size()) )
4664 if( !linux_mprotect((char *)_polling_page, Linux::page_size(), PROT_READ)) {
4670 // Linux doesn't yet have a (official) notion of processor sets,
4721 _epc = os::Linux::ucontext_get_pc((ucontext_t *) context.ucontext());
4740 int os::Linux::safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex, const struct timespec *_abstime)
4814 // This does not do anything on Linux. This is basically a hook for being
5016 // Linux doc says EINTR not returned, unlike Solaris
5076 int rc = os::Linux::pthread_getcpuclockid(tid, &clockid);
5089 if (os::Linux::supports_fast_thread_cpu_time()) {
5090 return os::Linux::fast_thread_cpu_time(CLOCK_THREAD_CPUTIME_ID);
5099 if (os::Linux::supports_fast_thread_cpu_time()) {
5100 return os::Linux::fast_thread_cpu_time(thread_cpu_clockid(thread));
5107 if (user_sys_cpu_time && os::Linux::supports_fast_thread_cpu_time()) {
5108 return os::Linux::fast_thread_cpu_time(CLOCK_THREAD_CPUTIME_ID);
5115 if (user_sys_cpu_time && os::Linux::supports_fast_thread_cpu_time()) {
5116 return os::Linux::fast_thread_cpu_time(thread_cpu_clockid(thread));
5165 // new Linux kernels 2.6+ where NPTL is supported.
5170 if (proc_task_unchecked && os::Linux::is_NPTL()) {
5231 // Linux doesn't yet have a (official) notion of processor sets,
5427 status = os::Linux::safe_cond_timedwait(_cond, _mutex, &abst);
5519 * a signed-32-bit value (except on 64-bit Linux) we have to watch for
5628 sigset_t* allowdebug_blocked = os::Linux::allowdebug_blocked_signals();
5639 status = os::Linux::safe_cond_timedwait (_cond, _mutex, &absTime) ;