From 16caa051cb7299312cdaf9d79eaef01d294474f6 Mon Sep 17 00:00:00 2001
Date: Thu, 15 Dec 2022 17:06:41 +0800
Subject: [PATCH 21/33] I68TO2: 8204595: add more thread-related system settings info
 to hs_error file on Linux
---
 hotspot/src/os/linux/vm/os_linux.cpp | 22 +++++++++++++++++++++-
 hotspot/src/os/linux/vm/os_linux.hpp |  1 +
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
index abf2031..1ec68ab 100644
--- a/hotspot/src/os/linux/vm/os_linux.cpp
+++ b/hotspot/src/os/linux/vm/os_linux.cpp
@@ -2249,6 +2249,8 @@ void os::print_os_info(outputStream* st) {

   os::Linux::print_process_memory_info(st);

+  os::Linux::print_proc_sys_info(st);
+
   os::Linux::print_container_info(st);
 }

@@ -2390,6 +2392,24 @@ void os::Linux::print_process_memory_info(outputStream* st) {

 }

+void os::Linux::print_proc_sys_info(outputStream* st) {
+  st->cr();
+  st->print_cr("/proc/sys/kernel/threads-max (system-wide limit on the number of threads):");
+  _print_ascii_file("/proc/sys/kernel/threads-max", st);
+  st->cr();
+  st->cr();
+
+  st->print_cr("/proc/sys/vm/max_map_count (maximum number of memory map areas a process may have):");
+  _print_ascii_file("/proc/sys/vm/max_map_count", st);
+  st->cr();
+  st->cr();
+
+  st->print_cr("/proc/sys/kernel/pid_max (system-wide limit on number of process identifiers):");
+  _print_ascii_file("/proc/sys/kernel/pid_max", st);
+  st->cr();
+  st->cr();
+}
+
 void os::Linux::print_container_info(outputStream* st) {
   if (!OSContainer::is_containerized()) {
     return;
@@ -6928,4 +6948,4 @@ bool os::trim_native_heap(os::size_change_t* rss_change) {
 #else
   return false; // musl
 #endif
-}
\ No newline at end of file
+}
diff --git a/hotspot/src/os/linux/vm/os_linux.hpp b/hotspot/src/os/linux/vm/os_linux.hpp
index 6c27bcb..4ee2c9b 100644
--- a/hotspot/src/os/linux/vm/os_linux.hpp
+++ b/hotspot/src/os/linux/vm/os_linux.hpp
@@ -125,6 +125,7 @@ class Linux {
   static void print_container_info(outputStream* st);
   static void print_distro_info(outputStream* st);
   static void print_libversion_info(outputStream* st);
+  static void print_proc_sys_info(outputStream* st);

  public:
   static bool _stack_is_executable;
--
1.8.3.1
