This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH] sysconf: Use conservative default for _SC_NPROCESSORS_ONLN [BZ #21542]
On Fri, Jun 9, 2017 at 5:22 AM, Florian Weimer <firstname.lastname@example.org> wrote:
> On 06/09/2017 02:17 PM, Zack Weinberg wrote:
>> On Fri, Jun 9, 2017 at 8:11 AM, Florian Weimer <email@example.com> wrote:
>>> On 06/02/2017 04:21 PM, Florian Weimer wrote:
>>>> 2017-06-02 Florian Weimer <firstname.lastname@example.org>
>>>> [BZ #21542]
>>>> * sysdeps/unix/sysv/linux/getsysstats.c (__get_nprocs): Default to
>>>> two if no accurate information is available.
>>>> * posix/tst-sysconf-empty-chroot.c: New file.
>>>> * posix/Makefile (tests): Add it.
>> It seems reasonable to me but I'm not sure I understand all of the implications.
> The implication is that the Hotspot JVM no longer crashes in a chroot on
> an SMP host because it assumes a UP host and elides atomics.
> The downside is that some other application could choose to use
> spinlocks on a UP system because glibc suggests it's SMP, which could
> result in terrible performance.
> All this is just for the corner case of an improperly setup
> chroot/contain (lacking key parts of /sys and /proc).
On x86, we compute the number of threads which share L3
cache in a package via CPUID. We should use this info as
default on x86.