LWN.net Logo

The Linaro Connect scheduler minisummit

The Linaro Connect scheduler minisummit

Posted Feb 24, 2012 18:47 UTC (Fri) by heechul (subscriber, #79852)
In reply to: The Linaro Connect scheduler minisummit by charlesgt_arm
Parent article: The Linaro Connect scheduler minisummit

Just like Qt, android dalvik also use sysconf(_SC_NPROCESSORS_ONLN) to report the number of available cpus to applications which then create the thread pools based on that information. Obviously, applications can suffer significant performance hit by dynamic hotplugging.

The right solution should be using sysconf(_SC_NPROCESSORS_CONF) which, in theory, should return the total available cpus instead of online ones.

The problem is that libc implementations, at least the android libc i used, do not distinguish the two and simply they are the same. i.e., report #of online cpus although _SC_NPROCESSORS_CONF is requested. They should be fixed as desired.

Then a question would be whether kernel has standard interface to userspace to report #online cpus and #available cpus so that libc can properlly implement both _SC_NPROCESSORS_CONF and _SC_NPROCESSORS_CONF.


(Log in to post comments)

The Linaro Connect scheduler minisummit

Posted Feb 29, 2012 19:45 UTC (Wed) by BenHutchings (subscriber, #37955) [Link]

Last time I looked, glibc was using /proc/cpuinfo. I think it should be using /sys/devices/system/cpu/online and
/sys/devices/system/cpu/possible, with a fallback to /proc/cpuinfo.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds