From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12789 Path: news.gmane.org!.POSTED!not-for-mail From: Patrick Oppenlander Newsgroups: gmane.linux.lib.musl.general Subject: Re: Some questions Date: Tue, 1 May 2018 12:35:58 +1000 Message-ID: References: <20180430031653.GI1392@brightrain.aerifal.cx> <20180430153555.GM1392@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1525142047 2277 195.159.176.226 (1 May 2018 02:34:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 1 May 2018 02:34:07 +0000 (UTC) Cc: musl@lists.openwall.com Original-X-From: musl-return-12805-gllmg-musl=m.gmane.org@lists.openwall.com Tue May 01 04:34:03 2018 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1fDL7C-0000Wr-Q0 for gllmg-musl@m.gmane.org; Tue, 01 May 2018 04:34:02 +0200 Original-Received: (qmail 18176 invoked by uid 550); 1 May 2018 02:36:11 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 18157 invoked from network); 1 May 2018 02:36:10 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:cc; bh=qeIaGjhS50i6K0R2C34ic+JHM+eug4oYS6mXBLGHg3I=; b=G3OXCtJNXg8axGwYB+lbo8yMt8sWBSOYwS+Gt795/+MqVjYrsRP/G/KLK/AfX64Mqw VB9iubDdqcpc9OJc+M5d0cK69VTIeLL1POK5B146pjWXhCJ2CSaxpWSRtSzRv0KG/YwM 5D+G2q+xQjR/LJNYJtb+eVzFiLQXN+S54BSJxN4xxld/KM44kyKbNiNzyCJEI3kYQ0m1 kuEjWczr/188OxL8vtq/c71eTKw7q6Rjb4SXP+hWOEzH4wCrZbTBmsU5mLkMnQKM6i0O qj3LPpDjM8mAtHHMD8Jr/WurmvBFJJT8nIlUqviavBnAIsfAZ4D5XsJYlF7gTBXkOYeq TvpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:cc; bh=qeIaGjhS50i6K0R2C34ic+JHM+eug4oYS6mXBLGHg3I=; b=GNmFyvmxyuBou5oAvhrKDqp3V3fVJKBbjT3SGADRbk342qR/AtWR6taBJqA0+QgoGn swtzkMEw/lFMOxGE1aLxgRJf4c90HAHCC0tBoZA0QSti8FB0FOeX0D62hgB+9pdOeJtx YRtFYgDNAa939Hk3RpRpWfEzZDhwqfa1fwP15eGHyvn6zgO7lCgVl6LjjFVxt0TaJHOz jtDnCzml5MLdEsP//zsoPrWcKrYoJjdyNmPohZgLEonhWcF3dE5oiOd+h1xx7aKrA+GC JDRTs4dh3LMVPvCkQUpPNZ8VE12Rxl/w9swVeiQ0B20YFxx8jFGKEvNUpqXMvXl2fKRK nRqg== X-Gm-Message-State: ALQs6tCD1JiIOZEhnkJ9n79Ao/xeJfRJSP0s+ZzDkalb95lZTWUhX9iY cMftIeQyK/gTLno9z+eyW2H2eS32qAY534ZUrBTJgCrM X-Google-Smtp-Source: AB8JxZqlUTs/ALTFAwMA8soMGfcqI+JcwNHqenPvI0YzvOZV/98Vpc/Ezt7Kb+NU9asvnbnJXPsVlC7XvKaV/QAUpJc= X-Received: by 2002:aed:3eee:: with SMTP id o43-v6mr12168906qtf.3.1525142159140; Mon, 30 Apr 2018 19:35:59 -0700 (PDT) In-Reply-To: <20180430153555.GM1392@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:12789 Archived-At: On Tue, May 1, 2018 at 1:35 AM, Rich Felker wrote: > On Mon, Apr 30, 2018 at 01:55:16PM +1000, Patrick Oppenlander wrote: >> I was talking about the case of a uniprocessor system running a multi >> theaded process. >> >> In that case the "spin" part of spinlock just burns time & electrons. >> The "lock" part obviously can't be omitted. Calling straight through >> to the kernel is the most efficient thing to do. > > I see. Is this an issue you've actually hit? I don't see any obvious > way to make this decision at runtime that doesn't incur unwanted costs > or failure modes, and I suspect we're spinning way too many times > anyway even for SMP (i.e. the ideal solution might just be > significantly reducing the # of spins). I haven't measured the performance impact of it. One option could be to configure the number of spins at compile time and set to zero for known uniprocessor architectures (like armv7m). Or have a configure override. Really this is just performance tuning, there's no danger of generating incorrect code. I can't find a way of detecting a SMP kernel other than parsing the result of uname(2) which sucks. I was hoping there might be something in auxv hwcap. Patrick