From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 32268 invoked from network); 15 Apr 2020 09:50:51 -0000 Received-SPF: pass (mother.openwall.net: domain of lists.openwall.com designates 195.42.179.200 as permitted sender) receiver=inbox.vuxu.org; client-ip=195.42.179.200 envelope-from= Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with UTF8ESMTPZ; 15 Apr 2020 09:50:51 -0000 Received: (qmail 6081 invoked by uid 550); 15 Apr 2020 09:50:49 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 6057 invoked from network); 15 Apr 2020 09:50:48 -0000 From: Florian Weimer To: Norbert Lange Cc: musl@lists.openwall.com, Rich Felker References: <20200409181824.GD13749@port70.net> <87r1wwik8t.fsf@mid.deneb.enyo.de> <20200410010255.GN11469@brightrain.aerifal.cx> <877dyinzuz.fsf@mid.deneb.enyo.de> <20200414155522.GB11469@brightrain.aerifal.cx> <87wo6iknx1.fsf@mid.deneb.enyo.de> Date: Wed, 15 Apr 2020 11:50:36 +0200 In-Reply-To: (Norbert Lange's message of "Wed, 15 Apr 2020 11:38:42 +0200") Message-ID: <87o8rtjcwj.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [musl] [BUG] sysconf implementing _SC_NPROCESSORS_(CONF|ONLN) incorrectly * Norbert Lange: > How should one deal with this? > I understand that the semantics are vague, but given that musl now > implements this > function, it will make detection and fallback hard (especially as musl > doesn't wants to be identified by the likes of macros). > > As it is now, just using the affinity mask definitely cant be useful, > an application wanting that behavior should be patched to > use that function directly. > If musl would not define the _SC_NPROCESSORS_* macros (but still keep > the implementation), > this could be used for compile-time detection atleast. Enabling the > current implementation would be > just a matter of explicitly defining those macros. _SC_NPROCESSORS_* as implemented in glibc is bad because those values are not adjusted by cgroups, so it can grossly overestimate available resources. The cgroups interfaces themselves are not stable and very complicated. I don't think it's a good idea to target them, especially not from code that is expected to be linked statically into applications. Given that, I'm not sure that glibc's way is a significant improvement. musl should perhaps be changed to cope more gracefully with a sched_getaffinity failure, though (by not reporting a UP environment by accident).