From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 0FED1A0096 for ; Wed, 5 Jun 2019 18:47:42 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D6CD21B9B0; Wed, 5 Jun 2019 18:47:41 +0200 (CEST) Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by dpdk.org (Postfix) with ESMTP id 16F3D1B993 for ; Wed, 5 Jun 2019 18:47:41 +0200 (CEST) Received: by mail-pf1-f195.google.com with SMTP id d126so15182902pfd.2 for ; Wed, 05 Jun 2019 09:47:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vFC2sJFSgJKfwolinduRRgYETZAhwzDtHjPUPGZ6I8s=; b=a25jCUsSkCx0q7SMPUTMoZ8Ty52x9A+WL0B/Mu436Zx4B2x0Uo2PsixDFUcqxAzavX 8GQ56b+1D2pPOLkv2CT5Zx2SWMibSSheWAABZTGL5wlXWxoq7k3zKhM6xugw+Eqyx1AI nd88HmJsldJO4rC4gaHwJgRl0KFfNbO1J5dAOTOAnUQNj88gk99w+O3kaHp1+W0WNPra R6Q7mMoaMmGSmJcwD9fwTHwFp37g3Ttmch/Zfnal0stGXwKBitEqkj5qoGirvaefPKuM U6p8XWbeTu4Hv0wFy1sQ4WShtrK1rmiMuKjrBmHCYAGdv3vFJYt+6jbSwDcdEC6TKcwY x6IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vFC2sJFSgJKfwolinduRRgYETZAhwzDtHjPUPGZ6I8s=; b=atwsndF/XixXEyCVUkHg8tJDHPjVchFJ1mU30FFGE0vOFO3pc8vr8hdDaPdJ7eqeOc Cf1RpzmpHXtjodlFNbJ6Z0uQ4OWq8h2lhIVL0ywlrAXQ4rO7aFsrtbOa4Aso3TRyYFMw waC1bcdSokGOXwcMW3MurzTsK1kfa/oRPYJzGI3i5Fz7c4mS64sVoD8iHuCG1ACgvxwW Htfw+QqBpLwYmiaKj8v6tXYDZ+wXyjyFD1UQS+IgNqWyBGkHkTRRJ2YSteJEzgqUBfjn 2r9gWLvcy2sb3V27rRhAz9RXb9zgGIwQDiitn8wZorTAtU7ENGMf2R4qsdMbYEg/xNH4 Aigw== X-Gm-Message-State: APjAAAWnTViSDq7HxbB5wQElz2MGoUnYmiVQpJeq9FHRKcHvMMgnOUXC nBt+CFI1JhySwITgmwBd4/iq8A== X-Google-Smtp-Source: APXvYqxDLxsN0KKXs29MxZsRxY+0A1vbUkTwRA4Nt7uLbEDTTJX0O7Azn052QXkZzZZLDMZrmduEyA== X-Received: by 2002:a63:950d:: with SMTP id p13mr5736760pgd.269.1559753260247; Wed, 05 Jun 2019 09:47:40 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id j37sm13820845pgj.58.2019.06.05.09.47.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Jun 2019 09:47:40 -0700 (PDT) Date: Wed, 5 Jun 2019 09:47:38 -0700 From: Stephen Hemminger To: Phil Yang Cc: dev@dpdk.org, thomas@monjalon.net, jerinj@marvell.com, hemant.agrawal@nxp.com, Honnappa.Nagarahalli@arm.com, gavin.hu@arm.com, nd@arm.com Message-ID: <20190605094738.5e7a455e@hermes.lan> In-Reply-To: <1559750328-22377-1-git-send-email-phil.yang@arm.com> References: <1559750328-22377-1-git-send-email-phil.yang@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH v1 0/3] MCS queued lock implementation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Wed, 5 Jun 2019 23:58:45 +0800 Phil Yang wrote: > This patch set added MCS lock library and its unit test. >=20 > The MCS lock (proposed by JOHN M. MELLOR-CRUMMEY and MICHAEL L. SCOTT) pr= ovides > scalability by spinning on a CPU/thread local variable which avoids expen= sive > cache bouncings. It provides fairness by maintaining a list of acquirers = and > passing the lock to each CPU/thread in the order they acquired the lock. >=20 > References: > 1. http://web.mit.edu/6.173/www/currentsemester/readings/R06-scalable-syn= chronization-1991.pdf > 2. https://lwn.net/Articles/590243/ >=20 > Mirco-benchmarking result: > -------------------------------------------------------------------------= ----------------------- > MCS lock | spinlock | ticket l= ock > ------------------------------+--------------------------------+---------= ----------------------- > Test with lock on 13 cores... | Test with lock on 14 cores... | Test wi= th lock on 14 cores... > Core [15] Cost Time =3D 22426 us| Core [14] Cost Time =3D 47974 us| Cor= e [14] cost time =3D 66761 us > Core [16] Cost Time =3D 22382 us| Core [15] Cost Time =3D 46979 us| Cor= e [15] cost time =3D 66766 us > Core [17] Cost Time =3D 22294 us| Core [16] Cost Time =3D 46044 us| Cor= e [16] cost time =3D 66761 us > Core [18] Cost Time =3D 22412 us| Core [17] Cost Time =3D 28793 us| Cor= e [17] cost time =3D 66767 us > Core [19] Cost Time =3D 22407 us| Core [18] Cost Time =3D 48349 us| Cor= e [18] cost time =3D 66758 us > Core [20] Cost Time =3D 22436 us| Core [19] Cost Time =3D 19381 us| Cor= e [19] cost time =3D 66766 us > Core [21] Cost Time =3D 22414 us| Core [20] Cost Time =3D 47914 us| Cor= e [20] cost time =3D 66763 us > Core [22] Cost Time =3D 22405 us| Core [21] Cost Time =3D 48333 us| Cor= e [21] cost time =3D 66766 us > Core [23] Cost Time =3D 22435 us| Core [22] Cost Time =3D 38900 us| Cor= e [22] cost time =3D 66749 us > Core [24] Cost Time =3D 22401 us| Core [23] Cost Time =3D 45374 us| Cor= e [23] cost time =3D 66765 us > Core [25] Cost Time =3D 22408 us| Core [24] Cost Time =3D 16121 us| Cor= e [24] cost time =3D 66762 us > Core [26] Cost Time =3D 22380 us| Core [25] Cost Time =3D 42731 us| Cor= e [25] cost time =3D 66768 us > Core [27] Cost Time =3D 22395 us| Core [26] Cost Time =3D 29439 us| Cor= e [26] cost time =3D 66768 us > | Core [27] Cost Time =3D 38071 us| Core = [27] cost time =3D 66767 us > ------------------------------+--------------------------------+---------= ----------------------- > Total Cost Time =3D 291195 us | Total Cost Time =3D 544403 us | Tot= al cost time =3D 934687 us > -------------------------------------------------------------------------= ----------------------- =46rom the user point of view there needs to be clear recommendations on which lock type to use. And if one of the lock types is always slower it should be deprecated long = term.