From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27154 invoked by alias); 11 Jul 2012 09:05:23 -0000 Received: (qmail 27029 invoked by uid 22791); 11 Jul 2012 09:05:22 -0000 X-SWARE-Spam-Status: No, hits=-4.7 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 Jul 2012 09:05:10 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1Sosr5-0004G4-GE from Maxim_Kuvyrkov@mentor.com ; Wed, 11 Jul 2012 02:05:07 -0700 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 11 Jul 2012 02:04:13 -0700 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.1.289.1; Wed, 11 Jul 2012 10:05:05 +0100 Subject: Re: [PATCH] Unify pthread_spin_[try]lock implementations. MIME-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset="iso-8859-1" From: Maxim Kuvyrkov In-Reply-To: <4FFD4114.9000806@redhat.com> Date: Wed, 11 Jul 2012 09:05:00 -0000 CC: David Miller , , , , , Content-Transfer-Encoding: quoted-printable Message-ID: References: <65B470D2-4D01-4BA1-AEC5-A72C0006EA22@codesourcery.com> <20120711081441.73BB22C093@topped-with-meat.com> <20120711.012509.1325789838255235021.davem@davemloft.net> <4FFD3CD9.4030206@redhat.com> <84304C03-6A49-4263-9016-05486EDC0E98@codesourcery.com> <4FFD4114.9000806@redhat.com> To: Andrew Haley Mailing-List: contact libc-ports-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-ports-owner@sourceware.org X-SW-Source: 2012-07/txt/msg00027.txt.bz2 On 11/07/2012, at 9:02 PM, Andrew Haley wrote: > On 07/11/2012 09:53 AM, Maxim Kuvyrkov wrote: >=20 ... >> This is an interesting point and maybe introducing a counter like >> below will improve spinlocks for ARM. >>=20 >> + int counter =3D 123456; >> + while (atomic_compare_and_exchange_val_acq (lock, 1, 0) !=3D 0) >> + while (*lock !=3D 0 && --counter) >> + ; >=20 > This is a much better idea than an unbounded spin. OK, but this will be a change on its own in a follow up patch. I want to k= eep this patch just a mechanical change. -- Maxim Kuvyrkov CodeSourcery / Mentor Graphics