Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp424609pxa; Fri, 21 Aug 2020 10:43:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlKhSMfhbwT2mJ180PPbsbPvkWMWlXpSANGMJVHTa5J/8tX56U+5GrCpPV4nG68EMFY+fo X-Received: by 2002:a05:6402:2033:: with SMTP id ay19mr3776508edb.361.1598031820835; Fri, 21 Aug 2020 10:43:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598031820; cv=none; d=google.com; s=arc-20160816; b=IcPzfGjbRUoW6lqUI8degTwR+CknFqKoKKx3L46744XM5R+eS/oHq09P2gs5yCqhJ9 BQcabxgHooESwd6lZ4lhm8jhUuJMONQe/TomA8/uy515I3SyIiaz0gBjFIRowQ4eQodM tJolgCt0zFKgvK0FqBlodkQLauAALlj78UMxzYKh0KqJhqMJ7NcirpsgyJK4PwH5SxeI wjHvN5LECddhI0OtgVnwvIG4P05XMNnvvWYigjeO7d1cZe/bdxbZGwrN/kUOk0EvRun0 n0E7FV0GOHtkt5F74F7praQsdzNezThUvJN/SQbxgHE+Dzl/sTdb7nu7sYj2m8DoxCn4 kTJA== 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=6BZYjkXJw2hECx4MwMllL13NtAbX5PJwgINVHzD8dEs=; b=ra1RHOSLnyNcvVuYk7zhIvw82lX/7WaryE9//W3DoeU4kNWoh5aaOvWCfQsRhjJ0pV bGvxFj7pGJk0iEqpKL/RgkwlIhAv1gXzBnLZcpEexOJGQzzs6BJz5uY0unDC0Qdl2W0C DPgbMo5JdnFhWj2Sb5rbjWv8TQIOCdcP2HT1GIAnutxI9Nf36vEwyaN8jqQNjGlPbGYu SL2xkNl98Ek86BcuixwWTCOmFVFCTEOwEgWQVGqX08aSoI3iDjmTw+OsjEB9HB8Pk/9S hj8xE/cWlr6iyoO0cp+IGrWYi2V7H2NXvcUXgHGwWaXWW7KWnDjzduzS1i9APWRc77ZE UFZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=HBfIXnbF; 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 l21si1182681ejc.297.2020.08.21.10.43.15; Fri, 21 Aug 2020 10:43:40 -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; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=HBfIXnbF; 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 S1726846AbgHURlo (ORCPT + 99 others); Fri, 21 Aug 2020 13:41:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725885AbgHURlo (ORCPT ); Fri, 21 Aug 2020 13:41:44 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B833EC061573; Fri, 21 Aug 2020 10:41:43 -0700 (PDT) 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; bh=6BZYjkXJw2hECx4MwMllL13NtAbX5PJwgINVHzD8dEs=; b=HBfIXnbFbKOM5MeWh+6dOLQ3al LzUl6SH6xEctUyN2iN8E8qDSk9eYhvqEI1/EZMqC/vgihb65WpE18kGfm3+Wl8kyUO62AgCtqvsBg kQzEBobaapdgKirQXRmYBIzhNgOnUEL+Tua9fQlCSpfLZT9oPt6VuPqofmowF72N4s1qPpe9bqYDh vyJ0+BMO2LI7KRYviMYeTIv2DZ/eVjOf3fP3rQyG2HlqdYhrurnO7wW5P3RNfH5K4Lm3ohUHMl5uR gn80tObV3tp6p0ppQ3sQVepg1+G8wXeJ40hUDZj5unjwQGiN+LMQNIAordLK7q93J6Qms6+3dg4zX lvyEaVSQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1k9B2n-000299-7z; Fri, 21 Aug 2020 17:41:37 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 0D33E980DF7; Fri, 21 Aug 2020 19:41:33 +0200 (CEST) Date: Fri, 21 Aug 2020 19:41:32 +0200 From: Peter Zijlstra To: Boqun Feng Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Ingo Molnar , Will Deacon , Jonathan Corbet , Waiman Long Subject: Re: [RFC v7 14/19] lockdep: Take read/write status in consideration when generate chainkey Message-ID: <20200821174132.GR3982@worktop.programming.kicks-ass.net> References: <20200807074238.1632519-1-boqun.feng@gmail.com> <20200807074238.1632519-15-boqun.feng@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200807074238.1632519-15-boqun.feng@gmail.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 So far so good, excellent work. On Fri, Aug 07, 2020 at 03:42:33PM +0800, Boqun Feng wrote: > @@ -371,6 +371,21 @@ static struct hlist_head classhash_table[CLASSHASH_SIZE]; > > static struct hlist_head chainhash_table[CHAINHASH_SIZE]; > > +/* > + * the id of held_lock > + */ > +static inline u16 hlock_id(struct held_lock *hlock) > +{ > + BUILD_BUG_ON(MAX_LOCKDEP_KEYS_BITS + 2 > 16); > + > + return (hlock->class_idx | (hlock->read << MAX_LOCKDEP_KEYS_BITS)); > +} > + > +static inline unsigned int chain_hlock_class_idx(u16 hlock_id) > +{ > + return hlock_id & MAX_LOCKDEP_KEYS; But did that want to be: return hlock_id & (MAX_LOCKDEP_KEYS-1); ? > +}