Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 77432 invoked from network); 13 Feb 2008 00:38:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Feb 2008 00:38:58 -0000 Received: (qmail 45149 invoked by uid 500); 13 Feb 2008 00:38:50 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 45124 invoked by uid 500); 13 Feb 2008 00:38:50 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 45115 invoked by uid 99); 13 Feb 2008 00:38:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Feb 2008 16:38:50 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of alexei.fedotov@gmail.com designates 66.249.92.169 as permitted sender) Received: from [66.249.92.169] (HELO ug-out-1314.google.com) (66.249.92.169) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Feb 2008 00:38:17 +0000 Received: by ug-out-1314.google.com with SMTP id u40so651051ugc.3 for ; Tue, 12 Feb 2008 16:38:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=GgxjPkdt2PSD4Mpe0bcvP/x28Rph1cdA2uIdMpayfYk=; b=CquFCzclcM+5cSIC8BRJJ9zK/NeqZGqJJu1Gv3+EoOvi22X9knYUIbU9YJpfKE5X78dpP1h5cjFIJPDjrhBPwyvTUwWBlCtdUqXAoStQIbhCq83/FL7ZG01bQayRTWc896nSdtv5cBkK3ZYtKaqTHmsx+aP3B6ygxOtjfnvCGU4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=vI5KkOdrKSCXCGHicAZzCx9UbtG0dztEMh1PvlcHuSo9wvyDzJV6EeK1ZDpjrVEsPwwHGIcny01FjhIGK+X/hKT88pkzDulTEf3U3t39ChLpGgeAgy4LLZTg+UxVRvrwVAcwCZIoQPKrfpWr3okKfczlVIfS0InXmoNtmPq9/4Q= Received: by 10.67.89.15 with SMTP id r15mr1252048ugl.12.1202863103938; Tue, 12 Feb 2008 16:38:23 -0800 (PST) Received: by 10.67.21.8 with HTTP; Tue, 12 Feb 2008 16:38:23 -0800 (PST) Message-ID: Date: Wed, 13 Feb 2008 03:38:23 +0300 From: "Alexei Fedotov" To: dev@harmony.apache.org Subject: Re: [drlvm][startup][performance] Implementing futex'es In-Reply-To: <4bebff790802121512x58533dabg9e426d440e798166@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4bebff790802121512x58533dabg9e426d440e798166@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org Hello Aleksey, Is not the current mutex implementation no less efficient than futex? I've heard that mutexes try to spin before switching to kernel, and Windows critical sections do the same trick. Thanks! On Feb 13, 2008 2:12 AM, Aleksey Shipilev wrote: > Hi, Alexei, all, > > Just another idea for startup optimizations pops out of our talk with > Egor Pasko. :) > > As you probably know there are many places in VM and JIT that use > locking for safety reasons. Most of this locking is driven by mutexes, > that is, the kernel calls. That's a good option in case of contention, > because such locking will need arbitration (e.g. "who will take the > mutex next"?) from kernel side. But what if that locking is not > contended? Even then we will make the kernel call for trying to catch > the mutex. > > Linux has long ago implemented such thing as "fast user-space mutex", > "futex" [1]. Generally it is simple memory region that could be > incremented/decremented atomically. In case of contention futex, of > course, will resort to kernel-side mutex. > > That mean we could save precious time using futexes instead of > mutexes: we definitely will save on kernel call time. > > AFAIK, current implementation of porting layer has no support for > futexes even on Linux side. And so we might try to implement them for > Windows part and use the Linux-provided futex'es on Linux part. Then > after the implementation of hyfutex_lock/unlock we might try to > migrate performance-significant locks to futexes one-by-one. Profilers > are good directions, maybe anywhere else too. > > What do you think? > > Thanks, > Aleksey, > ESSD, Intel > > [1] http://en.wikipedia.org/wiki/Futex > -- With best regards, Alexei