Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp253592pxa; Thu, 27 Aug 2020 00:59:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYCvE5Sxk7wuodZ2fnDikOb7Ue6qyGDZgGQb9KTjIZXJ+lqY3l2ihkGQjhwgP+iHOepqXF X-Received: by 2002:a17:906:3b4b:: with SMTP id h11mr7397931ejf.381.1598515186374; Thu, 27 Aug 2020 00:59:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598515186; cv=none; d=google.com; s=arc-20160816; b=SNvAB2t4vWm+6kbp4iVWw1rRL3iyAfDESmCH0PNcn0rfzriIQVjVf1v4N6d6eH49Ot PevNIIfEb50Yk+9VeYFBg8BHJe/sbVpUdd6IMuPkpl5nTcSkcJDtmO8vzYLhFaGFjZRC YqwCOTJ3Mx3pWOqARsk2iJXUMrdBghPDYm0kv+bi7aT8ubCyrw0yp4T75ULqoKuFPR+p crLBPZIX2C7uqsrKApxLYHVespEpBZHGjpiko63LByiaZa0ysR5DhnosSNBRuQEkrN2T CfPA67ca2NZNVG4SsvLsprJ4JU9wGnmytyQXJVL0vNzn1/zC1Vc9bkgn+J0Acul4DhbL 0ITw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:dkim-signature :dkim-signature:date; bh=l3YkGOPEQgwIky67ipFw2aeIOYSOatdnKx07RKeNUrI=; b=Oz3xAGJ0w5MKj6cNEqAtgUZwaFnuWLOGSug8i+u1ks20b1OQR/+XeAvtGG6FpXWfcQ WQGNQnLrcLVHAVRpgq6Hxh6E7U4hnd29VBRhD5IA5w2h8cPluK4fg7duVM1lyuRFCUfw 7pjd8V4I7JVo0eHi3yLPH8tuy36vuLHtygRkADOr6yGKl+amjyaDRTteCB//uujYVEXl H70Wg0vFBxU1CsH/fGaPdJAZ5BfkL3t60Q6YoYxMl1qlOaLVKaWDmzN0nYrJuaDIm2AM VFn8K+ucxtSXxV3pqOy/7JJYg/vQD2djyCOdxXT3JC4I/BydBhDdD/333dFir6BraxiC F1cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=EFRmWYKt; dkim=neutral (no key) header.i=@vger.kernel.org; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a3si847734ejc.80.2020.08.27.00.59.23; Thu, 27 Aug 2020 00:59:46 -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=@linutronix.de header.s=2020 header.b=EFRmWYKt; dkim=neutral (no key) header.i=@vger.kernel.org; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728760AbgH0H6E (ORCPT + 99 others); Thu, 27 Aug 2020 03:58:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728384AbgH0HyX (ORCPT ); Thu, 27 Aug 2020 03:54:23 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA6DDC06121A; Thu, 27 Aug 2020 00:54:22 -0700 (PDT) Date: Thu, 27 Aug 2020 07:54:20 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1598514861; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l3YkGOPEQgwIky67ipFw2aeIOYSOatdnKx07RKeNUrI=; b=EFRmWYKto8JizkRdGPCONVhvd1j+z2hrEckuB9dYgEbUEk7MsYhpwy8Bkbpf/+ROrNy46/ agdRupTXNDKaSTbzgfD3KKnOhU5mP8IDx72ol8jHJxnRzvXBioJzbgm6Y2wsPNcC7wMOdV d+N3Eh5BN7F2FT/dIZhyOcqxvnmguoaAjF1tJRrBfmIKfXPNCMBeXY4oWTHNIZzZmdx3xk FBld43DGjO5iASkKp9jB+Zg/+x24/23KCj8hwdckOwOUY+HUhUYPla4esi0L2XRoFItEkc 48ZsxgFxyZ/Pf0JjzSFtrWL6WtCFzeJw94pr2K/e7EF9ou9Ytvb1ZMYm+nQ3dA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1598514861; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l3YkGOPEQgwIky67ipFw2aeIOYSOatdnKx07RKeNUrI=; b=oDiPxqQDd9Ro3rFF0wmIRZtplbw/YDVCFILuVh69XdU6bI22eFXo2Vs2lDG5GH1mkemY/3 6rvBbBXkYMSeIOBg== From: "tip-bot2 for Boqun Feng" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] lockdep: Reduce the size of lock_list::distance Cc: Peter Zijlstra , Boqun Feng , x86 , LKML In-Reply-To: <20200807074238.1632519-6-boqun.feng@gmail.com> References: <20200807074238.1632519-6-boqun.feng@gmail.com> MIME-Version: 1.0 Message-ID: <159851486062.20229.11037063852084225523.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the locking/core branch of tip: Commit-ID: bd76eca10de2eb9998d5125b08e8997cbf5508d5 Gitweb: https://git.kernel.org/tip/bd76eca10de2eb9998d5125b08e8997cbf5508d5 Author: Boqun Feng AuthorDate: Fri, 07 Aug 2020 15:42:24 +08:00 Committer: Peter Zijlstra CommitterDate: Wed, 26 Aug 2020 12:42:04 +02:00 lockdep: Reduce the size of lock_list::distance lock_list::distance is always not greater than MAX_LOCK_DEPTH (which is 48 right now), so a u16 will fit. This patch reduces the size of lock_list::distance to save space, so that we can introduce other fields to help detect recursive read lock deadlocks without increasing the size of lock_list structure. Suggested-by: Peter Zijlstra Signed-off-by: Boqun Feng Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20200807074238.1632519-6-boqun.feng@gmail.com --- include/linux/lockdep.h | 2 +- kernel/locking/lockdep.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 7cae5ea..2275010 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h @@ -54,7 +54,7 @@ struct lock_list { struct lock_class *class; struct lock_class *links_to; const struct lock_trace *trace; - int distance; + u16 distance; /* * The parent field is used to implement breadth-first search, and the diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 150686a..668a983 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -1320,7 +1320,7 @@ static struct lock_list *alloc_list_entry(void) */ static int add_lock_to_list(struct lock_class *this, struct lock_class *links_to, struct list_head *head, - unsigned long ip, int distance, + unsigned long ip, u16 distance, const struct lock_trace *trace) { struct lock_list *entry; @@ -2489,7 +2489,7 @@ check_deadlock(struct task_struct *curr, struct held_lock *next) */ static int check_prev_add(struct task_struct *curr, struct held_lock *prev, - struct held_lock *next, int distance, + struct held_lock *next, u16 distance, struct lock_trace **const trace) { struct lock_list *entry; @@ -2622,7 +2622,7 @@ check_prevs_add(struct task_struct *curr, struct held_lock *next) goto out_bug; for (;;) { - int distance = curr->lockdep_depth - depth + 1; + u16 distance = curr->lockdep_depth - depth + 1; hlock = curr->held_locks + depth - 1; /*