From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752626AbdB1NKv (ORCPT ); Tue, 28 Feb 2017 08:10:51 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:47571 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752564AbdB1NKY (ORCPT ); Tue, 28 Feb 2017 08:10:24 -0500 Date: Tue, 28 Feb 2017 14:10:12 +0100 From: Peter Zijlstra To: Byungchul Park 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: <20170228131012.GI5680@worktop> References: <1484745459-2055-1-git-send-email-byungchul.park@lge.com> <1484745459-2055-7-git-send-email-byungchul.park@lge.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1484745459-2055-7-git-send-email-byungchul.park@lge.com> User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +#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. > + > +/* 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.