Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp662176ybi; Tue, 16 Jul 2019 03:23:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqx5ThlMFEXrTWfUhSWjbdTp21Jy6VRHtHxRKn3OmpJhSqzksifOXYgcUxr+rLYXkIH3zIjc X-Received: by 2002:a17:902:2a27:: with SMTP id i36mr33679031plb.161.1563272624725; Tue, 16 Jul 2019 03:23:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563272624; cv=none; d=google.com; s=arc-20160816; b=TCakhwAzw3m2BB8qrMvTBy5BLoAgNzS1lrFNgJeIEk4GCvdtQTpRZjJmQEUIy8r3ji XV+lV+kJDcKBLNd8XqSrB+23sAfiHKt0/oDO9Yq1kGwFV6aRLXZ2SnSy0MAe/nqDDsWX Cgmp23ojvQxwWiHACM/aB9UmOLYmVrY+sNs8QCcmyMtoIdCi0TV5plBYeU2dYovrBfjg WCQ5k1x8CHJVJ3+AYvOx36RVARRQmM8DyWL7tU5+qMWiKyQajOTrtX/3yfOB3GJqriEg IPn/cQH/qqnhOTNHFGEiUXM6AgQqLKXc5wtO0cM0agUsjwBJDs0hW80bIYt6qK43z5+O Ca1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=+jPmiLFoLFkErQnsFP18srbHMWPmmDSQUv0S0HNnLWo=; b=S6cJDqN7X2eNERNJZADWQHCt1b7O6odLSl3XgnLd0Ob6yKNnVsXhL3FRxEB5PCA7yE eekjIcvv/jAUH7gPEs+tIQhkg294orcoY0L7Rx+7/8TeiITHAWvD0f/Si1SRl/CwGJ7Z bNB3AVI2fFh8KOHR8LrkjICuqK2TIXfnceCS6hmDYe9+xd++neQ98H1wJwboAFfdQT/u 338RHRk4qLSVST6nH2UgH/dbDbPC/7PaKEThWALKe+VFirWFxYhqyzuXhx5hPVL25Nf3 bG/Jdrzzp1A6Sqa6a4wjAEEMUkQmtkAF78M8ge2AlQAHny+nGw1idmAeG5Ry/qPXngrB R+3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=1FCCrHiw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t184si19862941pgd.211.2019.07.16.03.23.28; Tue, 16 Jul 2019 03:23:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=1FCCrHiw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733083AbfGPKVX (ORCPT + 99 others); Tue, 16 Jul 2019 06:21:23 -0400 Received: from merlin.infradead.org ([205.233.59.134]:56740 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731401AbfGPKVX (ORCPT ); Tue, 16 Jul 2019 06:21:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+jPmiLFoLFkErQnsFP18srbHMWPmmDSQUv0S0HNnLWo=; b=1FCCrHiw6wHWzTKNNLJJ628q3 sfZxcu4lXp8UOSjklMM84EEttE7cH/rxMVbAXKhQFu/3gZ+10G+GnD+QOGbggR+a4ntTcNNLYXw6j HQwYBI7Ip3s3jo0xYu5aAhxsO3PdiOkRFEk7AC6tY7L756h2yeZid6XR7FOoEIDs4wrGIKWBypx6+ 29+ITIL/Aw/WCMapng0MkEzqtfJq2WfLPttOSGcTayXz12kmjfnqKQ1/O4cinbNjMouqSZ1YNkODG xCHWvcC8YQP8U9hwBoJRuKV0DN2nezJlsVl3CsaH//S3ws6GsMrkZoCA9+TfD1jPwDtslYWwL3NIq t5kPYIzrg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hnKZX-0005uN-La; Tue, 16 Jul 2019 10:20:36 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 58FB52021C301; Tue, 16 Jul 2019 12:20:34 +0200 (CEST) Date: Tue, 16 Jul 2019 12:20:34 +0200 From: Peter Zijlstra To: Alex Kogan Cc: linux@armlinux.org.uk, mingo@redhat.com, will.deacon@arm.com, arnd@arndb.de, longman@redhat.com, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, bp@alien8.de, hpa@zytor.com, x86@kernel.org, guohanjun@huawei.com, jglauber@marvell.com, steven.sistare@oracle.com, daniel.m.jordan@oracle.com, dave.dice@oracle.com, rahul.x.yadav@oracle.com Subject: Re: [PATCH v3 2/5] locking/qspinlock: Refactor the qspinlock slow path Message-ID: <20190716102034.GN3419@hirez.programming.kicks-ass.net> References: <20190715192536.104548-1-alex.kogan@oracle.com> <20190715192536.104548-3-alex.kogan@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190715192536.104548-3-alex.kogan@oracle.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 15, 2019 at 03:25:33PM -0400, Alex Kogan wrote: > +/* > + * set_locked_empty_mcs - Try to set the spinlock value to _Q_LOCKED_VAL, > + * and by doing that unlock the MCS lock when its waiting queue is empty > + * @lock: Pointer to queued spinlock structure > + * @val: Current value of the lock > + * @node: Pointer to the MCS node of the lock holder > + * > + * *,*,* -> 0,0,1 > + */ > +static __always_inline bool __set_locked_empty_mcs(struct qspinlock *lock, > + u32 val, > + struct mcs_spinlock *node) > +{ > + return atomic_try_cmpxchg_relaxed(&lock->val, &val, _Q_LOCKED_VAL); > +} That name is nonsense. It should be something like: static __always_inline bool __try_clear_tail(...) > +/* > + * pass_mcs_lock - pass the MCS lock to the next waiter > + * @node: Pointer to the MCS node of the lock holder > + * @next: Pointer to the MCS node of the first waiter in the MCS queue > + */ > +static __always_inline void __pass_mcs_lock(struct mcs_spinlock *node, > + struct mcs_spinlock *next) > +{ > + arch_mcs_spin_unlock_contended(&next->locked, 1); > +} I'm not entirely happy with that name either; but it's not horrible like the other one. Why not mcs_spin_unlock_contended() ?