Re: sablevm.processor.affinity patch
"Grzegorz B. Prokopski" <[email protected]>
| Newsgroups | gmane.comp.java.vm.sablevm.devel |
|---|---|
| Organization | SableVM - LGPL'ed Free Java VM http://sablevm.org |
| Message-ID | <[email protected]> |
On Wed, 2004-11-17 at 21:14, Chris Pickett wrote: > Here is my initial crack at support for processor affinity in SableVM. Thanks Chris, this looks fairly good. Some remarks: - all this stuff has to use #ifdef __linux__ around C code - on your test system (SMP Gentoo Linux?), does the normal sched_setaffinity() call work or not? What is its version of glibc? - if you need to directly use the syscall() you should have #ifdef __NR_sched_setaffinity or maybe rather traditional #ifdef SYS_sched_setaffinity. Otherwise the compilation would fail on systems that do not have it defined. - I think that for now, until SMP issues get fixed, we should use sysconf() to detect no. of CPUs and if it's bigger than 1 try to set affinity to a randomly choosen CPU. There should be an informative message about it happening outputted while this workaround for SMP problems is activated. - looks like the vm->vprintf is assigned fairly early in JNI_CreateJavaVM, so you should be able to use _svmf_printf() for printing out any messages (and IMO they should go to stderr, as they're not part of normal program output). I am not convinced we really need a configure option for all that. Checking whether SYS_sched_affinity is defined should be enough to ensure that sched_setaffinity() call exists at all. And calling syscall() (on Linux) in the worst case will fail which is non-critical failure. Thus where possible - we can compile this code in, where not - we'll automatically disable it using #ifdefs. Chris, can you prepare an updated patch? Comments? GBP -- Grzegorz B. Prokopski <[email protected]> SableVM - Free, LGPL'ed Java VM http://sablevm.org Why SableVM ?!? http://sablevm.org/wiki/Features Debian GNU/Linux - the Free OS http://www.debian.org