From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752488AbdB1OKG (ORCPT ); Tue, 28 Feb 2017 09:10:06 -0500 Received: from LGEAMRELO13.lge.com ([156.147.23.53]:60317 "EHLO lgeamrelo13.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752447AbdB1OKD (ORCPT ); Tue, 28 Feb 2017 09:10:03 -0500 X-Original-SENDERIP: 156.147.1.121 X-Original-MAILFROM: byungchul.park@lge.com X-Original-SENDERIP: 10.177.222.33 X-Original-MAILFROM: byungchul.park@lge.com Date: Tue, 28 Feb 2017 22:24:44 +0900 From: Byungchul Park To: Peter Zijlstra Cc: mingo@kernel.org, tglx@linutronix.de, walken@google.com, boqun.feng@gmail.com, kirill@shutemov.name, linux-kernel@vger.kernel.org, linux-mm@kvack.org, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, npiggin@gmail.com Subject: Re: [PATCH v5 06/13] lockdep: Implement crossrelease feature Message-ID: <20170228132444.GG3817@X58A-UD3R> References: <1484745459-2055-1-git-send-email-byungchul.park@lge.com> <1484745459-2055-7-git-send-email-byungchul.park@lge.com> <20170228131012.GI5680@worktop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170228131012.GI5680@worktop> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 28, 2017 at 02:10:12PM +0100, Peter Zijlstra wrote: > > +#ifdef CONFIG_LOCKDEP_CROSSRELEASE > > + > > +#define idx(t) ((t)->xhlock_idx) > > +#define idx_prev(i) ((i) ? (i) - 1 : MAX_XHLOCKS_NR - 1) > > +#define idx_next(i) (((i) + 1) % MAX_XHLOCKS_NR) > > Note that: > > #define idx_prev(i) (((i) - 1) % MAX_XHLOCKS_NR) > #define idx_next(i) (((i) + 1) % MAX_XHLOCKS_NR) > > is more symmetric and easier to understand. OK. I will do it after forcing MAX_XHLOCKS_NR to be power of 2. Current value of it is already power of 2 but I need to add comment explaning it. > > + > > +/* For easy access to xhlock */ > > +#define xhlock(t, i) ((t)->xhlocks + (i)) > > +#define xhlock_prev(t, l) xhlock(t, idx_prev((l) - (t)->xhlocks)) > > +#define xhlock_curr(t) xhlock(t, idx(t)) > > So these result in an xhlock pointer > > > +#define xhlock_incr(t) ({idx(t) = idx_next(idx(t));}) > > This does not; which is confusing seeing how they share the same > namespace; also incr is weird. OK.. Could you suggest a better name? xhlock_adv()? advance_xhlock()? And.. replace it with a function?