review request for 6673124
Xiaobin Lu
Xiaobin.Lu at Sun.COM
Sat Oct 4 11:32:27 PDT 2008
Webrev: http://webrev.invokedynamic.info/xiaobin.lu/6673124/webrev/
Details:
Hotspot needs to compute the number of available CPUs available to the
java process in order to determine which flavor of VM to be used or how
many GC threads needs to created for parallel collector. Also, the user
could call Runtime.availableProcessors() and use that result to
determine how many threads needs to be created for their applications, etc.
Here is the current way to compute that number on Solaris where the
problem might be seen. First, we check whether the process is bound to a
existing processor set, if yes, we then check how many processors inside
that processor set and use that number as the available CPUs. If not, we
just return the number of total online CPUs as the number of available
CPUs. This ignores the fact that even the process is NOT running inside
a processor set, however, if there is any processor set around, the CPUs
in that processor set won't be available to the java process. So the
correct way of doing this is to ignore whether the process is bound to a
processor set or not, as long as "pset_bind" returns successfully, we
then use "pset_info" to check the available CPUs to us.
We decided not to invent another flag to fall back to the old behavior
which is absolutely wrong. Plus it is hard to come up with a sensible
name for that flag, not to mention the user has to dig through
globals.hpp to find out that flag to use.
Reviewed by:
Verified by:
Experiments made on multi-core Solaris machines and trace put in the
code to verify the return value is correct.
JPRT.
Thanks,
-Xiaobin
More information about the hotspot-dev
mailing list