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 45AEFA0096 for ; Wed, 5 Jun 2019 18:30:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1B42C1BBD8; Wed, 5 Jun 2019 18:30:09 +0200 (CEST) Received: from mail-vs1-f66.google.com (mail-vs1-f66.google.com [209.85.217.66]) by dpdk.org (Postfix) with ESMTP id 2396F1BBD0 for ; Wed, 5 Jun 2019 18:30:08 +0200 (CEST) Received: by mail-vs1-f66.google.com with SMTP id m8so6988014vsj.0 for ; Wed, 05 Jun 2019 09:30:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/uA87a0jWVTPkMtiFdoi3bILYn//6bNxkIkYjAh/5Iw=; b=eCsct61gE+rd81CFxSF6dUA54oOnIUzrAu7lrVfDn5uyltZnALhmgmgltJ/zkUdPNP 5x8WqBF1qmP5oQCLGfquTGt+mGD7s/YVVb7rNQKI5CI5RWlCLiIPLOHTTfUJfaNs6QJ0 kqMv4Yd7Pt1yfe6feDHXf1lZYfn+HwF+zE+joruLmoqvWW0+Eb1TF9sGOPZ/AGP8x5y+ CURygL9RqsgG1i4cN3lWMscLAZW25P5HdlGnom9aiBw66qKugvwyNTm7e6sEqtgjl6yw MR6X0A4P1yRQvBVqA69UhH3K/fz91m+cSpldxHnldxWGYC7IzdkpSgttPihLU4zb1LKH m+NQ== X-Gm-Message-State: APjAAAWyUh6B25uKFg+M7nctaG9c4Yj8JovVtiM4qkE2R/XMeksa6uVK r/i+vVU+j5IEv80JPQYzFDWrEordnWBta4bOc0583w== X-Google-Smtp-Source: APXvYqyR8/e60Uck/3fAmqIT8IuY/PpfqZMMw7cm91GW1QfItQY35KTNCYZ0KiH9SaTsc56rDPnJtA+vFFK/ufeCgfU= X-Received: by 2002:a67:e9ca:: with SMTP id q10mr9640197vso.105.1559752207609; Wed, 05 Jun 2019 09:30:07 -0700 (PDT) MIME-Version: 1.0 References: <1559750328-22377-1-git-send-email-phil.yang@arm.com> In-Reply-To: <1559750328-22377-1-git-send-email-phil.yang@arm.com> From: David Marchand Date: Wed, 5 Jun 2019 18:29:56 +0200 Message-ID: To: Phil Yang Cc: dev , Thomas Monjalon , Jerin Jacob Kollanukkaran , hemant.agrawal@nxp.com, Honnappa Nagarahalli , Gavin Hu , nd Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 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, Jun 5, 2019 at 6:00 PM Phil Yang wrote: > This patch set added MCS lock library and its unit test. > > The MCS lock (proposed by JOHN M. MELLOR-CRUMMEY and MICHAEL L. SCOTT) > provides > scalability by spinning on a CPU/thread local variable which avoids > expensive > 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. > > References: > 1. > http://web.mit.edu/6.173/www/currentsemester/readings/R06-scalable-synchronization-1991.pdf > 2. https://lwn.net/Articles/590243/ > > Mirco-benchmarking result: > > ------------------------------------------------------------------------------------------------ > MCS lock | spinlock | ticket > lock > > ------------------------------+--------------------------------+-------------------------------- > Test with lock on 13 cores... | Test with lock on 14 cores... | Test > with lock on 14 cores... > Core [15] Cost Time = 22426 us| Core [14] Cost Time = 47974 us| Core > [14] cost time = 66761 us > Core [16] Cost Time = 22382 us| Core [15] Cost Time = 46979 us| Core > [15] cost time = 66766 us > Core [17] Cost Time = 22294 us| Core [16] Cost Time = 46044 us| Core > [16] cost time = 66761 us > Core [18] Cost Time = 22412 us| Core [17] Cost Time = 28793 us| Core > [17] cost time = 66767 us > Core [19] Cost Time = 22407 us| Core [18] Cost Time = 48349 us| Core > [18] cost time = 66758 us > Core [20] Cost Time = 22436 us| Core [19] Cost Time = 19381 us| Core > [19] cost time = 66766 us > Core [21] Cost Time = 22414 us| Core [20] Cost Time = 47914 us| Core > [20] cost time = 66763 us > Core [22] Cost Time = 22405 us| Core [21] Cost Time = 48333 us| Core > [21] cost time = 66766 us > Core [23] Cost Time = 22435 us| Core [22] Cost Time = 38900 us| Core > [22] cost time = 66749 us > Core [24] Cost Time = 22401 us| Core [23] Cost Time = 45374 us| Core > [23] cost time = 66765 us > Core [25] Cost Time = 22408 us| Core [24] Cost Time = 16121 us| Core > [24] cost time = 66762 us > Core [26] Cost Time = 22380 us| Core [25] Cost Time = 42731 us| Core > [25] cost time = 66768 us > Core [27] Cost Time = 22395 us| Core [26] Cost Time = 29439 us| Core > [26] cost time = 66768 us > | Core [27] Cost Time = 38071 us| Core > [27] cost time = 66767 us > > ------------------------------+--------------------------------+-------------------------------- > Total Cost Time = 291195 us | Total Cost Time = 544403 us | Total > cost time = 934687 us > > ------------------------------------------------------------------------------------------------ > Had a quick look, interesting. Quick comments: - your numbers are for 13 cores, while the other are for 14, what is the reason? - do we need per architecture header? all I can see is generic code, we might as well directly put rte_mcslock.h in the common/include directory. - could we replace the current spinlock with this approach? is this more expensive than spinlock on lowly contended locks? is there a reason we want to keep all these approaches? we could have now 3 lock implementations. - do we need to write the authors names in full capitalized version? it seems like you are shouting :-) -- David Marchand