Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp180045ybr; Fri, 22 May 2020 04:08:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJM4a/uoLuwwip67JpMp7VQ5Qpsyqw7MMH8g7F/KxU1DeGJC2ltAR8TZT4ikNrDeOUC16o X-Received: by 2002:a05:6402:3106:: with SMTP id dc6mr2444390edb.19.1590145692067; Fri, 22 May 2020 04:08:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590145692; cv=none; d=google.com; s=arc-20160816; b=U2jSi6WPjN5sQGWzrRjHTtWibdqPKtEC3tRVK9PxKIHfmGyu0oM7blzRfBZUkHikFG QwRfyiCff2KtQK4p5rmpg8yNKOLvJgsG0T2480JDNdtgUSnI1z44zABmepYavviepD3w wTomVy1KREi7Afp9x0Va4r9GRNnEoV/+oEE3ht+nGQ7Hesyi8hHVQD3JTJw8NFZqF8xd LWZiQFci2GM5Tf1wAD7uSweGxjlqb2UkeBT/4yHillc+puxwzRju+iUXkyoqifE1/Fc8 vFIwGLq7LSq5JItMi/DKMTgNaG4pkR6xS3qWqx/yMJ8lAltQM/s1UyoQFNQTPzbDp4Xa 4nZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=cu2wWQSC+OUMbIAcDgUTlpwWJReNiOoa1PwT2kes8S8=; b=GzrQ5hAxaf+s1Gf22l7W31aowTeKgFbMR+MUlMYE/A6QQtQ9zeZOMLOTtkpwNoZ1Dm Z0UGpvwZiyaWnw4yRkblefFBjegjnSmZYg3oqqoypQ8XpNHq6SFbCoF7HGrA46a+GvrO 9a4/PtN8/N17AefpJrzHV1EkoRoTkRb75Nl5DdRFVzZvLvrqpgFJ5MHX+q6wnWE8Bw5J LpseQMgw1gXW5Xf38uX2PxQuVu9QEd1azYPJl1V4tsMp8ETjduJ2mYXDffKwzVZtvpHN rlzXx/i2/Gq+wvIJUNHIHiDomJlx0X+FI2qEGSTVc7jED5X0qcvBCRR9eNIVrq9s1FfG u2kg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lu16si4917210ejb.600.2020.05.22.04.07.47; Fri, 22 May 2020 04:08:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729106AbgEVLGD (ORCPT + 99 others); Fri, 22 May 2020 07:06:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728371AbgEVLGB (ORCPT ); Fri, 22 May 2020 07:06:01 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D1ACC061A0E for ; Fri, 22 May 2020 04:06:01 -0700 (PDT) Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1jc5Uz-0002l6-Qe; Fri, 22 May 2020 13:05:57 +0200 Date: Fri, 22 May 2020 13:05:56 +0200 From: Sebastian Andrzej Siewior To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Steven Rostedt , Will Deacon , Thomas Gleixner , "Paul E . McKenney" , Linus Torvalds Subject: Re: [PATCH 1/8] locking: Introduce local_lock() Message-ID: <20200522110556.czizy72ak2nr32ve@linutronix.de> References: <20200519201912.1564477-1-bigeasy@linutronix.de> <20200519201912.1564477-2-bigeasy@linutronix.de> <20200520120450.GL317569@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200520120450.GL317569@hirez.programming.kicks-ass.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-05-20 14:04:50 [+0200], Peter Zijlstra wrote: > On Tue, May 19, 2020 at 10:19:05PM +0200, Sebastian Andrzej Siewior wrote: > > +/** > > + * DEFINE_LOCAL_LOCK - Define and initialize a per CPU local lock > > + * @lock: Name of the lock instance > > + */ > > +#define DEFINE_LOCAL_LOCK(lvar) \ > > + DEFINE_PER_CPU(struct local_lock, lvar) = { INIT_LOCAL_LOCK(lvar) } > > + > > +/** > > + * DECLARE_LOCAL_LOCK - Declare a defined per CPU local lock > > + * @lock: Name of the lock instance > > + */ > > +#define DECLARE_LOCAL_LOCK(lvar) \ > > + DECLARE_PER_CPU(struct local_lock, lvar) > > So I think I'm going to argue having these is a mistake. The local_lock > should be put in a percpu structure along with the data it actually > protects. So I got rid of these and made the local_lock part of the per-CPU struct. > > +#ifdef CONFIG_DEBUG_LOCK_ALLOC > > +# define LL_DEP_MAP_INIT(lockname) .dep_map = { .name = #lockname } > > That wants to be: > > .dep_map = { > .name = #lockname, > .wait_type_inner = LD_WAIT_SPIN, Why LD_WAIT_SPIN and not LD_WAIT_SLEEP? On RT the lock becomes sleeping and none of the SPIN restrictions apply. > } > > > +#else > > +# define LL_DEP_MAP_INIT(lockname) > > +#endif Sebastian