src/hotspot/os/linux/os_linux.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File open Sdiff src/hotspot/os/linux

src/hotspot/os/linux/os_linux.hpp

Print this page




  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef OS_LINUX_VM_OS_LINUX_HPP
  26 #define OS_LINUX_VM_OS_LINUX_HPP
  27 
  28 // Linux_OS defines the interface to Linux operating systems
  29 
  30 // Information about the protection of the page at address '0' on this os.
  31 static bool zero_page_read_protected() { return true; }
  32 
  33 class Linux {
  34   friend class os;

  35   friend class TestReserveMemorySpecial;
  36 
  37   static bool libjsig_is_loaded;        // libjsig that interposes sigaction(),
  38                                         // __sigaction(), signal() is loaded
  39   static struct sigaction *(*get_signal_action)(int);
  40   static struct sigaction *get_preinstalled_handler(int);
  41   static void save_preinstalled_handler(int, struct sigaction&);
  42 
  43   static void check_signal_handler(int sig);
  44 
  45   static int (*_clock_gettime)(clockid_t, struct timespec *);
  46   static int (*_pthread_getcpuclockid)(pthread_t, clockid_t *);
  47   static int (*_pthread_setname_np)(pthread_t, const char*);
  48 
  49   static address   _initial_thread_stack_bottom;
  50   static uintptr_t _initial_thread_stack_size;
  51 
  52   static const char *_glibc_version;
  53   static const char *_libpthread_version;
  54 


  58   static GrowableArray<int>* _nindex_to_node;
  59 
  60   // 0x00000000 = uninitialized,
  61   // 0x01000000 = kernel version unknown,
  62   // otherwise a 32-bit number:
  63   // Ox00AABBCC
  64   // AA, Major Version
  65   // BB, Minor Version
  66   // CC, Fix   Version
  67   static uint32_t _os_version;
  68 
  69  protected:
  70 
  71   static julong _physical_memory;
  72   static pthread_t _main_thread;
  73   static Mutex* _createThread_lock;
  74   static int _page_size;
  75 
  76   static julong available_memory();
  77   static julong physical_memory() { return _physical_memory; }



  78   static void initialize_system_info();
  79 
  80   static int commit_memory_impl(char* addr, size_t bytes, bool exec);
  81   static int commit_memory_impl(char* addr, size_t bytes,
  82                                 size_t alignment_hint, bool exec);
  83 
  84   static void set_glibc_version(const char *s)      { _glibc_version = s; }
  85   static void set_libpthread_version(const char *s) { _libpthread_version = s; }
  86 
  87   static void rebuild_cpu_to_node_map();
  88   static void rebuild_nindex_to_node_map();
  89   static GrowableArray<int>* cpu_to_node()    { return _cpu_to_node; }
  90   static GrowableArray<int>* nindex_to_node()  { return _nindex_to_node; }
  91 
  92   static size_t find_large_page_size();
  93   static size_t setup_large_page_size();
  94 
  95   static bool setup_large_page_type(size_t page_size);
  96   static bool transparent_huge_pages_sanity_check(bool warn, size_t pages_size);
  97   static bool hugetlbfs_sanity_check(bool warn, size_t page_size);
  98 
  99   static char* reserve_memory_special_shm(size_t bytes, size_t alignment, char* req_addr, bool exec);
 100   static char* reserve_memory_special_huge_tlbfs(size_t bytes, size_t alignment, char* req_addr, bool exec);
 101   static char* reserve_memory_special_huge_tlbfs_only(size_t bytes, char* req_addr, bool exec);
 102   static char* reserve_memory_special_huge_tlbfs_mixed(size_t bytes, size_t alignment, char* req_addr, bool exec);
 103 
 104   static bool release_memory_special_impl(char* base, size_t bytes);
 105   static bool release_memory_special_shm(char* base, size_t bytes);
 106   static bool release_memory_special_huge_tlbfs(char* base, size_t bytes);
 107 
 108   static void print_full_memory_info(outputStream* st);

 109   static void print_distro_info(outputStream* st);
 110   static void print_libversion_info(outputStream* st);
 111 
 112  public:
 113   static bool _stack_is_executable;
 114   static void *dlopen_helper(const char *name, char *ebuf, int ebuflen);
 115   static void *dll_load_in_vmthread(const char *name, char *ebuf, int ebuflen);
 116 
 117   static void init_thread_fpu_state();
 118   static int  get_fpu_control_word();
 119   static void set_fpu_control_word(int fpu_control);
 120   static pthread_t main_thread(void)                                { return _main_thread; }
 121   // returns kernel thread id (similar to LWP id on Solaris), which can be
 122   // used to access /proc
 123   static pid_t gettid();
 124   static void set_createThread_lock(Mutex* lk)                      { _createThread_lock = lk; }
 125   static Mutex* createThread_lock(void)                             { return _createThread_lock; }
 126   static void hotspot_sigmask(Thread* thread);
 127 
 128   static address   initial_thread_stack_bottom(void)                { return _initial_thread_stack_bottom; }




  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef OS_LINUX_VM_OS_LINUX_HPP
  26 #define OS_LINUX_VM_OS_LINUX_HPP
  27 
  28 // Linux_OS defines the interface to Linux operating systems
  29 
  30 // Information about the protection of the page at address '0' on this os.
  31 static bool zero_page_read_protected() { return true; }
  32 
  33 class Linux {
  34   friend class os;
  35   friend class OSContainer;
  36   friend class TestReserveMemorySpecial;
  37 
  38   static bool libjsig_is_loaded;        // libjsig that interposes sigaction(),
  39                                         // __sigaction(), signal() is loaded
  40   static struct sigaction *(*get_signal_action)(int);
  41   static struct sigaction *get_preinstalled_handler(int);
  42   static void save_preinstalled_handler(int, struct sigaction&);
  43 
  44   static void check_signal_handler(int sig);
  45 
  46   static int (*_clock_gettime)(clockid_t, struct timespec *);
  47   static int (*_pthread_getcpuclockid)(pthread_t, clockid_t *);
  48   static int (*_pthread_setname_np)(pthread_t, const char*);
  49 
  50   static address   _initial_thread_stack_bottom;
  51   static uintptr_t _initial_thread_stack_size;
  52 
  53   static const char *_glibc_version;
  54   static const char *_libpthread_version;
  55 


  59   static GrowableArray<int>* _nindex_to_node;
  60 
  61   // 0x00000000 = uninitialized,
  62   // 0x01000000 = kernel version unknown,
  63   // otherwise a 32-bit number:
  64   // Ox00AABBCC
  65   // AA, Major Version
  66   // BB, Minor Version
  67   // CC, Fix   Version
  68   static uint32_t _os_version;
  69 
  70  protected:
  71 
  72   static julong _physical_memory;
  73   static pthread_t _main_thread;
  74   static Mutex* _createThread_lock;
  75   static int _page_size;
  76 
  77   static julong available_memory();
  78   static julong physical_memory() { return _physical_memory; }
  79   static void set_physical_memory(julong phys_mem) { _physical_memory = phys_mem; }
  80   static int active_processor_count();
  81 
  82   static void initialize_system_info();
  83 
  84   static int commit_memory_impl(char* addr, size_t bytes, bool exec);
  85   static int commit_memory_impl(char* addr, size_t bytes,
  86                                 size_t alignment_hint, bool exec);
  87 
  88   static void set_glibc_version(const char *s)      { _glibc_version = s; }
  89   static void set_libpthread_version(const char *s) { _libpthread_version = s; }
  90 
  91   static void rebuild_cpu_to_node_map();
  92   static void rebuild_nindex_to_node_map();
  93   static GrowableArray<int>* cpu_to_node()    { return _cpu_to_node; }
  94   static GrowableArray<int>* nindex_to_node()  { return _nindex_to_node; }
  95 
  96   static size_t find_large_page_size();
  97   static size_t setup_large_page_size();
  98 
  99   static bool setup_large_page_type(size_t page_size);
 100   static bool transparent_huge_pages_sanity_check(bool warn, size_t pages_size);
 101   static bool hugetlbfs_sanity_check(bool warn, size_t page_size);
 102 
 103   static char* reserve_memory_special_shm(size_t bytes, size_t alignment, char* req_addr, bool exec);
 104   static char* reserve_memory_special_huge_tlbfs(size_t bytes, size_t alignment, char* req_addr, bool exec);
 105   static char* reserve_memory_special_huge_tlbfs_only(size_t bytes, char* req_addr, bool exec);
 106   static char* reserve_memory_special_huge_tlbfs_mixed(size_t bytes, size_t alignment, char* req_addr, bool exec);
 107 
 108   static bool release_memory_special_impl(char* base, size_t bytes);
 109   static bool release_memory_special_shm(char* base, size_t bytes);
 110   static bool release_memory_special_huge_tlbfs(char* base, size_t bytes);
 111 
 112   static void print_full_memory_info(outputStream* st);
 113   static void print_container_info(outputStream* st);
 114   static void print_distro_info(outputStream* st);
 115   static void print_libversion_info(outputStream* st);
 116 
 117  public:
 118   static bool _stack_is_executable;
 119   static void *dlopen_helper(const char *name, char *ebuf, int ebuflen);
 120   static void *dll_load_in_vmthread(const char *name, char *ebuf, int ebuflen);
 121 
 122   static void init_thread_fpu_state();
 123   static int  get_fpu_control_word();
 124   static void set_fpu_control_word(int fpu_control);
 125   static pthread_t main_thread(void)                                { return _main_thread; }
 126   // returns kernel thread id (similar to LWP id on Solaris), which can be
 127   // used to access /proc
 128   static pid_t gettid();
 129   static void set_createThread_lock(Mutex* lk)                      { _createThread_lock = lk; }
 130   static Mutex* createThread_lock(void)                             { return _createThread_lock; }
 131   static void hotspot_sigmask(Thread* thread);
 132 
 133   static address   initial_thread_stack_bottom(void)                { return _initial_thread_stack_bottom; }


src/hotspot/os/linux/os_linux.hpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File