120 #endif |
120 #endif |
121 #ifndef MADV_ACCESS_MANY |
121 #ifndef MADV_ACCESS_MANY |
122 # define MADV_ACCESS_MANY 8 /* many processes to access heavily */ |
122 # define MADV_ACCESS_MANY 8 /* many processes to access heavily */ |
123 #endif |
123 #endif |
124 |
124 |
|
125 #ifndef LGRP_RSRC_CPU |
|
126 # define LGRP_RSRC_CPU 0 /* CPU resources */ |
|
127 #endif |
|
128 #ifndef LGRP_RSRC_MEM |
|
129 # define LGRP_RSRC_MEM 1 /* memory resources */ |
|
130 #endif |
|
131 |
125 // Some more macros from sys/mman.h that are not present in Solaris 8. |
132 // Some more macros from sys/mman.h that are not present in Solaris 8. |
126 |
133 |
127 #ifndef MAX_MEMINFO_CNT |
134 #ifndef MAX_MEMINFO_CNT |
128 /* |
135 /* |
129 * info_req request type definitions for meminfo |
136 * info_req request type definitions for meminfo |
2638 if (r == -1) { |
2645 if (r == -1) { |
2639 ids[0] = 0; |
2646 ids[0] = 0; |
2640 return 1; |
2647 return 1; |
2641 } |
2648 } |
2642 if (!r) { |
2649 if (!r) { |
|
2650 // That's a leaf node. |
2643 assert (bottom <= cur, "Sanity check"); |
2651 assert (bottom <= cur, "Sanity check"); |
2644 ids[bottom++] = ids[cur]; |
2652 // Check if the node has memory |
|
2653 if (Solaris::lgrp_resources(Solaris::lgrp_cookie(), ids[cur], |
|
2654 NULL, 0, LGRP_RSRC_MEM) > 0) { |
|
2655 ids[bottom++] = ids[cur]; |
|
2656 } |
2645 } |
2657 } |
2646 top += r; |
2658 top += r; |
2647 cur++; |
2659 cur++; |
2648 } |
2660 } |
2649 return bottom; |
2661 return bottom; |
2662 return false; |
2674 return false; |
2663 } |
2675 } |
2664 |
2676 |
2665 // Get the group id of the current LWP. |
2677 // Get the group id of the current LWP. |
2666 int os::numa_get_group_id() { |
2678 int os::numa_get_group_id() { |
2667 int lgrp_id = os::Solaris::lgrp_home(P_LWPID, P_MYID); |
2679 int lgrp_id = Solaris::lgrp_home(P_LWPID, P_MYID); |
2668 if (lgrp_id == -1) { |
2680 if (lgrp_id == -1) { |
2669 return 0; |
2681 return 0; |
2670 } |
2682 } |
2671 return lgrp_id; |
2683 const int size = os::numa_get_groups_num(); |
|
2684 int *ids = (int*)alloca(size * sizeof(int)); |
|
2685 |
|
2686 // Get the ids of all lgroups with memory; r is the count. |
|
2687 int r = Solaris::lgrp_resources(Solaris::lgrp_cookie(), lgrp_id, |
|
2688 (Solaris::lgrp_id_t*)ids, size, LGRP_RSRC_MEM); |
|
2689 if (r <= 0) { |
|
2690 return 0; |
|
2691 } |
|
2692 return ids[os::random() % r]; |
2672 } |
2693 } |
2673 |
2694 |
2674 // Request information about the page. |
2695 // Request information about the page. |
2675 bool os::get_page_info(char *start, page_info* info) { |
2696 bool os::get_page_info(char *start, page_info* info) { |
2676 const uint_t info_types[] = { MEMINFO_VLGRP, MEMINFO_VPAGESIZE }; |
2697 const uint_t info_types[] = { MEMINFO_VLGRP, MEMINFO_VPAGESIZE }; |
4351 os::Solaris::lgrp_home_func_t os::Solaris::_lgrp_home; |
4372 os::Solaris::lgrp_home_func_t os::Solaris::_lgrp_home; |
4352 os::Solaris::lgrp_init_func_t os::Solaris::_lgrp_init; |
4373 os::Solaris::lgrp_init_func_t os::Solaris::_lgrp_init; |
4353 os::Solaris::lgrp_fini_func_t os::Solaris::_lgrp_fini; |
4374 os::Solaris::lgrp_fini_func_t os::Solaris::_lgrp_fini; |
4354 os::Solaris::lgrp_root_func_t os::Solaris::_lgrp_root; |
4375 os::Solaris::lgrp_root_func_t os::Solaris::_lgrp_root; |
4355 os::Solaris::lgrp_children_func_t os::Solaris::_lgrp_children; |
4376 os::Solaris::lgrp_children_func_t os::Solaris::_lgrp_children; |
|
4377 os::Solaris::lgrp_resources_func_t os::Solaris::_lgrp_resources; |
4356 os::Solaris::lgrp_nlgrps_func_t os::Solaris::_lgrp_nlgrps; |
4378 os::Solaris::lgrp_nlgrps_func_t os::Solaris::_lgrp_nlgrps; |
4357 os::Solaris::lgrp_cookie_stale_func_t os::Solaris::_lgrp_cookie_stale; |
4379 os::Solaris::lgrp_cookie_stale_func_t os::Solaris::_lgrp_cookie_stale; |
4358 os::Solaris::lgrp_cookie_t os::Solaris::_lgrp_cookie = 0; |
4380 os::Solaris::lgrp_cookie_t os::Solaris::_lgrp_cookie = 0; |
4359 |
4381 |
4360 // (Static) wrapper for meminfo() call. |
4382 // (Static) wrapper for meminfo() call. |
4553 os::Solaris::set_lgrp_home(CAST_TO_FN_PTR(lgrp_home_func_t, dlsym(handle, "lgrp_home"))); |
4575 os::Solaris::set_lgrp_home(CAST_TO_FN_PTR(lgrp_home_func_t, dlsym(handle, "lgrp_home"))); |
4554 os::Solaris::set_lgrp_init(CAST_TO_FN_PTR(lgrp_init_func_t, dlsym(handle, "lgrp_init"))); |
4576 os::Solaris::set_lgrp_init(CAST_TO_FN_PTR(lgrp_init_func_t, dlsym(handle, "lgrp_init"))); |
4555 os::Solaris::set_lgrp_fini(CAST_TO_FN_PTR(lgrp_fini_func_t, dlsym(handle, "lgrp_fini"))); |
4577 os::Solaris::set_lgrp_fini(CAST_TO_FN_PTR(lgrp_fini_func_t, dlsym(handle, "lgrp_fini"))); |
4556 os::Solaris::set_lgrp_root(CAST_TO_FN_PTR(lgrp_root_func_t, dlsym(handle, "lgrp_root"))); |
4578 os::Solaris::set_lgrp_root(CAST_TO_FN_PTR(lgrp_root_func_t, dlsym(handle, "lgrp_root"))); |
4557 os::Solaris::set_lgrp_children(CAST_TO_FN_PTR(lgrp_children_func_t, dlsym(handle, "lgrp_children"))); |
4579 os::Solaris::set_lgrp_children(CAST_TO_FN_PTR(lgrp_children_func_t, dlsym(handle, "lgrp_children"))); |
|
4580 os::Solaris::set_lgrp_resources(CAST_TO_FN_PTR(lgrp_resources_func_t, dlsym(handle, "lgrp_resources"))); |
4558 os::Solaris::set_lgrp_nlgrps(CAST_TO_FN_PTR(lgrp_nlgrps_func_t, dlsym(handle, "lgrp_nlgrps"))); |
4581 os::Solaris::set_lgrp_nlgrps(CAST_TO_FN_PTR(lgrp_nlgrps_func_t, dlsym(handle, "lgrp_nlgrps"))); |
4559 os::Solaris::set_lgrp_cookie_stale(CAST_TO_FN_PTR(lgrp_cookie_stale_func_t, |
4582 os::Solaris::set_lgrp_cookie_stale(CAST_TO_FN_PTR(lgrp_cookie_stale_func_t, |
4560 dlsym(handle, "lgrp_cookie_stale"))); |
4583 dlsym(handle, "lgrp_cookie_stale"))); |
4561 |
4584 |
4562 lgrp_cookie_t c = lgrp_init(LGRP_VIEW_CALLER); |
4585 lgrp_cookie_t c = lgrp_init(LGRP_VIEW_CALLER); |