src/hotspot/os/linux/os_linux.cpp
changeset 51092 3b5fd72147c9
parent 51038 3312e730c791
parent 51070 2f4c3cac8556
child 51106 f605c91e5219
equal deleted inserted replaced
51059:bb16beb8f792 51092:3b5fd72147c9
  2091     }
  2091     }
  2092   }
  2092   }
  2093   // special case for debian
  2093   // special case for debian
  2094   if (file_exists("/etc/debian_version")) {
  2094   if (file_exists("/etc/debian_version")) {
  2095     strncpy(buf, "Debian ", buflen);
  2095     strncpy(buf, "Debian ", buflen);
  2096     parse_os_info(&buf[7], buflen-7, "/etc/debian_version");
  2096     if (buflen > 7) {
       
  2097       parse_os_info(&buf[7], buflen-7, "/etc/debian_version");
       
  2098     }
  2097   } else {
  2099   } else {
  2098     strncpy(buf, "Linux", buflen);
  2100     strncpy(buf, "Linux", buflen);
  2099   }
  2101   }
  2100 }
  2102 }
  2101 
  2103 
  2803   }
  2805   }
  2804   return 0;
  2806   return 0;
  2805 }
  2807 }
  2806 
  2808 
  2807 int os::Linux::get_existing_num_nodes() {
  2809 int os::Linux::get_existing_num_nodes() {
  2808   size_t node;
  2810   int node;
  2809   size_t highest_node_number = Linux::numa_max_node();
  2811   int highest_node_number = Linux::numa_max_node();
  2810   int num_nodes = 0;
  2812   int num_nodes = 0;
  2811 
  2813 
  2812   // Get the total number of nodes in the system including nodes without memory.
  2814   // Get the total number of nodes in the system including nodes without memory.
  2813   for (node = 0; node <= highest_node_number; node++) {
  2815   for (node = 0; node <= highest_node_number; node++) {
  2814     if (isnode_in_existing_nodes(node)) {
  2816     if (isnode_in_existing_nodes(node)) {
  2817   }
  2819   }
  2818   return num_nodes;
  2820   return num_nodes;
  2819 }
  2821 }
  2820 
  2822 
  2821 size_t os::numa_get_leaf_groups(int *ids, size_t size) {
  2823 size_t os::numa_get_leaf_groups(int *ids, size_t size) {
  2822   size_t highest_node_number = Linux::numa_max_node();
  2824   int highest_node_number = Linux::numa_max_node();
  2823   size_t i = 0;
  2825   size_t i = 0;
  2824 
  2826 
  2825   // Map all node ids in which is possible to allocate memory. Also nodes are
  2827   // Map all node ids in which it is possible to allocate memory. Also nodes are
  2826   // not always consecutively available, i.e. available from 0 to the highest
  2828   // not always consecutively available, i.e. available from 0 to the highest
  2827   // node number.
  2829   // node number.
  2828   for (size_t node = 0; node <= highest_node_number; node++) {
  2830   for (int node = 0; node <= highest_node_number; node++) {
  2829     if (Linux::isnode_in_configured_nodes(node)) {
  2831     if (Linux::isnode_in_configured_nodes((unsigned int)node)) {
  2830       ids[i++] = node;
  2832       ids[i++] = node;
  2831     }
  2833     }
  2832   }
  2834   }
  2833   return i;
  2835   return i;
  2834 }
  2836 }