< prev index next >

src/hotspot/os/linux/os_linux.cpp

Print this page

5297   // 1. Without numactl and heap will be allocated/configured on all nodes as
5298   //    per the system policy.
5299   // 2. With numactl --interleave:
5300   //      Use numa_get_interleave_mask(v2) API to get nodes bitmask. The same
5301   //      API for membind case bitmask is reset.
5302   //      Interleave is only hint and Kernel can fallback to other nodes if
5303   //      no memory is available on the target nodes.
5304   // 3. With numactl --membind:
5305   //      Use numa_get_membind(v2) API to get nodes bitmask. The same API for
5306   //      interleave case returns bitmask of all nodes.
5307   // numa_all_nodes_ptr holds bitmask of all nodes.
5308   // numa_get_interleave_mask(v2) and numa_get_membind(v2) APIs returns correct
5309   // bitmask when externally configured to run on all or fewer nodes.
5310 
5311   if (!Linux::libnuma_init()) {
5312     FLAG_SET_ERGO(UseNUMA, false);
5313     FLAG_SET_ERGO(UseNUMAInterleaving, false); // Also depends on libnuma.
5314   } else {
5315     if ((Linux::numa_max_node() < 1) || Linux::is_bound_to_single_node()) {
5316       // If there's only one node (they start from 0) or if the process
5317       // is bound explicitly to a single node using membind, disable NUMA unless
5318       // user explicilty forces NUMA optimizations on single-node/UMA systems
5319       UseNUMA = ForceNUMA;
5320     } else {
5321 
5322       LogTarget(Info,os) log;
5323       LogStream ls(log);
5324 
5325       Linux::set_configured_numa_policy(Linux::identify_numa_policy());
5326 
5327       struct bitmask* bmp = Linux::_numa_membind_bitmask;
5328       const char* numa_mode = "membind";
5329 
5330       if (Linux::is_running_in_interleave_mode()) {
5331         bmp = Linux::_numa_interleave_bitmask;
5332         numa_mode = "interleave";
5333       }
5334 
5335       ls.print("UseNUMA is enabled and invoked in '%s' mode."
5336                " Heap will be configured using NUMA memory nodes:", numa_mode);
5337 
5338       for (int node = 0; node <= Linux::numa_max_node(); node++) {
5339         if (Linux::_numa_bitmask_isbitset(bmp, node)) {
5340           ls.print(" %d", node);
5341         }

5297   // 1. Without numactl and heap will be allocated/configured on all nodes as
5298   //    per the system policy.
5299   // 2. With numactl --interleave:
5300   //      Use numa_get_interleave_mask(v2) API to get nodes bitmask. The same
5301   //      API for membind case bitmask is reset.
5302   //      Interleave is only hint and Kernel can fallback to other nodes if
5303   //      no memory is available on the target nodes.
5304   // 3. With numactl --membind:
5305   //      Use numa_get_membind(v2) API to get nodes bitmask. The same API for
5306   //      interleave case returns bitmask of all nodes.
5307   // numa_all_nodes_ptr holds bitmask of all nodes.
5308   // numa_get_interleave_mask(v2) and numa_get_membind(v2) APIs returns correct
5309   // bitmask when externally configured to run on all or fewer nodes.
5310 
5311   if (!Linux::libnuma_init()) {
5312     FLAG_SET_ERGO(UseNUMA, false);
5313     FLAG_SET_ERGO(UseNUMAInterleaving, false); // Also depends on libnuma.
5314   } else {
5315     if ((Linux::numa_max_node() < 1) || Linux::is_bound_to_single_node()) {
5316       // If there's only one node (they start from 0) or if the process
5317       // is bound explicitly to a single node using membind, disable NUMA
5318       UseNUMA = false;

5319     } else {

5320       LogTarget(Info,os) log;
5321       LogStream ls(log);
5322 
5323       Linux::set_configured_numa_policy(Linux::identify_numa_policy());
5324 
5325       struct bitmask* bmp = Linux::_numa_membind_bitmask;
5326       const char* numa_mode = "membind";
5327 
5328       if (Linux::is_running_in_interleave_mode()) {
5329         bmp = Linux::_numa_interleave_bitmask;
5330         numa_mode = "interleave";
5331       }
5332 
5333       ls.print("UseNUMA is enabled and invoked in '%s' mode."
5334                " Heap will be configured using NUMA memory nodes:", numa_mode);
5335 
5336       for (int node = 0; node <= Linux::numa_max_node(); node++) {
5337         if (Linux::_numa_bitmask_isbitset(bmp, node)) {
5338           ls.print(" %d", node);
5339         }
< prev index next >