From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752255AbcF3M71 (ORCPT ); Thu, 30 Jun 2016 08:59:27 -0400 Received: from merlin.infradead.org ([205.233.59.134]:56404 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751900AbcF3M70 (ORCPT ); Thu, 30 Jun 2016 08:59:26 -0400 Date: Thu, 30 Jun 2016 14:59:19 +0200 From: Peter Zijlstra To: Byungchul Park Cc: mingo@kernel.org, linux-kernel@vger.kernel.org, npiggin@suse.de, sergey.senozhatsky@gmail.com, gregkh@linuxfoundation.org, minchan@kernel.org Subject: Re: [PATCH 1/5] lockdep: Implement bitlock map allocator Message-ID: <20160630125919.GD30154@twins.programming.kicks-ass.net> References: <1466398515-1005-1-git-send-email-byungchul.park@lge.com> <1466398515-1005-2-git-send-email-byungchul.park@lge.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1466398515-1005-2-git-send-email-byungchul.park@lge.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 20, 2016 at 01:55:11PM +0900, Byungchul Park wrote: > +struct bitlock_map { > + struct hlist_node hash_entry; > + unsigned long bitaddr; /* ID */ > + struct lockdep_map map; > + int ref; /* reference count */ > +}; So this is effectively bigger than just adding a struct lockdep_map into whatever structure holds the bit spinlock to begin with. What is the gain? > +static inline unsigned long get_bitaddr(int bitnum, unsigned long *addr) > +{ > + return (unsigned long)((char *)addr + bitnum); > +} And given you keep these lockdep_map thingies out-of-line, the original structure remains dense and thus the above munging can easily result in collisions. Now, I suppose its rather unlikely, but given its entirely silent if it happens, this is bad.