Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp446576yba; Wed, 24 Apr 2019 04:11:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqzVh44zRitgQlWRrO05P90TS4XoqRgwYuhMfFCC9YvzyKWuWF9VDNtnlodZ4q9E8UGLQF6r X-Received: by 2002:a65:62cc:: with SMTP id m12mr30317991pgv.118.1556104284807; Wed, 24 Apr 2019 04:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556104284; cv=none; d=google.com; s=arc-20160816; b=VTMVmf7igpBow9rvuUYY6TPx6WbA0CN9Y7hNY3jEp4+MuUHGObSgW43mE12q/9tTRS cbGD1kHYdfseYPoHXlpVi/Nthdnje3RlLQHcY1u54B3sDf/S+waq84Is/l7V+G8Mp3zl kmgqkjz2oeRkdQT2BY4dOYLSEggsXFuehlLPpoI9m+iFW0rbQioRfCy4hs6LDmnh7Qz5 cx3/rq8gUCDVvEZNR5zPeL0Hk3YU2u4GHdM73c1InEeX8U2mBih2dT+iE6vb34phxFY4 S0J3DK73H8jmaiDqj1qj+8JHOV/IRq+GA1X0F1sSiaYqSHKBlAYMCoFLQNm1zavtlZRb cPVw== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4i8ndKb48XdQYlFpCqUcVw/pSceEV1kvm2UZn1AkLHA=; b=PWE+YNa+x3DZxxf26UhXTyyfqUIvMrsKWKb22Gb6f+HJ+DmO6ppDg69kcDbN/5f3yE x/v5pI+h0h0f8blQ8n3E92h9w2+G6/dzgvYSJ0ltu4hLrGRpri4ccLtCZoIFkEKc34zz KGpqJoQgmdY0wtRx1bqkbSY1A3xEgI7Ellgody0BmIRdKZ9LKTa59SIAhG0vjbrutyKn T5lEsDMVtdBUs5ZzKlw6vEzV8nwnvaIa5zFMsrD1SkrUGDwfJw77mMlxB085E/LAX1a8 wJzAyae9USOetILmSlivVbgsafVXOUhmCPid3BEo3v8OBrXQ1U6u25SJKwa0xXbGRe4t AD6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vB+Akpu0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w21si18205063pgj.513.2019.04.24.04.11.09; Wed, 24 Apr 2019 04:11:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vB+Akpu0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729346AbfDXKWE (ORCPT + 99 others); Wed, 24 Apr 2019 06:22:04 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:35622 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727826AbfDXKVv (ORCPT ); Wed, 24 Apr 2019 06:21:51 -0400 Received: by mail-pf1-f193.google.com with SMTP id t21so9094819pfh.2 for ; Wed, 24 Apr 2019 03:21:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4i8ndKb48XdQYlFpCqUcVw/pSceEV1kvm2UZn1AkLHA=; b=vB+Akpu02PPMocUZ04mkoowzxARnUwWoU/ONDqDCKbrX+f1pWC9TeTMZ6XiCDm0l47 NJyIYLmaSSdK///6D2pzrERsPTzL9Cod05J6EUKkE0BbrzjSKjkq6CQa4vP9sTINuzEZ UY2H7iDEsPDLU9AlnMDs3jJl4p0puDQRAiCVvRHmuqh/pQQ/4s/k/SMpUGCAzElcUNK5 zIFRIfJ5Kgg4IXjK1oaXYXiKw44xpU/vfifU6WEP6F/baVuUeif7tlpJNY5UizHhE5UI bI8zz/P0kDHvHYSzN+nsnuazyXk4D45xsYF4Tf5ZzYRle8i2B4ZfHRrjT5YCgfITAvHz z8zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4i8ndKb48XdQYlFpCqUcVw/pSceEV1kvm2UZn1AkLHA=; b=nA6oUo3tNsMArjdMLqyd3KpiHIeFptvhZass73dip97Fh7NOoMfJtHLUKi2p0NF+8U P6ecbbBirR1P4nbZ0ihequ1TVZ0dOG/DHdWLNvz0JDp33x3f0fshIEi96fzJID9cQ9ll 8VwfP+Fjj86rnx7hNgmXgKch7dm1bdeHuZ9rIvZDh4dFyVQzr0vqsf1QeDxibvgR5M0a /fFh66WDsWp+/4chNrAgDj3vaRAFHz0Anlsv0FPLWkOmXnYc2dLp3V60KqD7vqv6hY8W 14vnyfxIvgR8RH0wRNf13fVXY4t18OgIxVDpza1a9V47oW4Z1ao4IYDX7XCtJ0wGgFYu OERw== X-Gm-Message-State: APjAAAXJ3np1G199YRCss9e9cC8YioZTrdGc0VLHXbL0tb68mfC2eML3 fMPluJWxLls4hMse3GJ9MyM= X-Received: by 2002:a62:f20e:: with SMTP id m14mr33634724pfh.228.1556101311327; Wed, 24 Apr 2019 03:21:51 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id v19sm25051604pfn.62.2019.04.24.03.21.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Apr 2019 03:21:50 -0700 (PDT) From: Yuyang Du To: peterz@infradead.org, will.deacon@arm.com, mingo@kernel.org Cc: bvanassche@acm.org, ming.lei@redhat.com, frederic@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, Yuyang Du Subject: [PATCH 27/28] locking/lockdep: Remove locks_before Date: Wed, 24 Apr 2019 18:19:33 +0800 Message-Id: <20190424101934.51535-28-duyuyang@gmail.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20190424101934.51535-1-duyuyang@gmail.com> References: <20190424101934.51535-1-duyuyang@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since the backward dependencies are always empty, remove the locks_before field in lock_class struct and its occurrences. Signed-off-by: Yuyang Du --- include/linux/lockdep.h | 5 ++--- kernel/locking/lockdep.c | 15 +++------------ 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 0e209b8..d0a587c 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h @@ -97,10 +97,9 @@ struct lock_class { /* * These fields represent a directed graph of lock dependencies, - * to every node we attach a list of "forward" and a list of - * "backward" graph nodes. + * to every node we attach a list of "forward" graph nodes. */ - struct list_head locks_after, locks_before; + struct list_head locks_after; struct lockdep_subclass_key *key; unsigned int subclass; diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index acaa3b3..fa6611e 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -823,8 +823,7 @@ static bool in_list(struct list_head *e, struct list_head *h) } /* - * Check whether entry @e occurs in any of the locks_after or locks_before - * lists. + * Check whether entry @e occurs in any of the locks_after list. */ static bool in_any_class_list(struct list_head *e) { @@ -833,8 +832,7 @@ static bool in_any_class_list(struct list_head *e) for (i = 0; i < ARRAY_SIZE(lock_classes); i++) { class = &lock_classes[i]; - if (in_list(e, &class->locks_after) || - in_list(e, &class->locks_before)) + if (in_list(e, &class->locks_after)) return true; } return false; @@ -922,8 +920,6 @@ static bool __check_data_structures(void) /* Check whether all classes have valid lock lists. */ for (i = 0; i < ARRAY_SIZE(lock_classes); i++) { class = &lock_classes[i]; - if (!class_lock_list_valid(class, &class->locks_before)) - return false; if (!class_lock_list_valid(class, &class->locks_after)) return false; } @@ -1021,7 +1017,6 @@ static void init_data_structures_once(void) for (i = 0; i < ARRAY_SIZE(lock_classes); i++) { list_add_tail(&lock_classes[i].lock_entry, &free_lock_classes); INIT_LIST_HEAD(&lock_classes[i].locks_after); - INIT_LIST_HEAD(&lock_classes[i].locks_before); } } @@ -1151,7 +1146,6 @@ static bool is_dynamic_key(const struct lock_class_key *key) class->key = key; class->name = lock->name; class->subclass = subclass; - WARN_ON_ONCE(!list_empty(&class->locks_before)); WARN_ON_ONCE(!list_empty(&class->locks_after)); class->name_version = count_matching_names(class); for (i = 0; i < ARRAY_SIZE(class->irqsafe_distance); i++) @@ -4798,8 +4792,7 @@ static void zap_class(struct pending_free *pf, struct lock_class *class) nr_list_entries--; list_del_rcu(&entry->entry); } - if (list_empty(&class->locks_after) && - list_empty(&class->locks_before)) { + if (list_empty(&class->locks_after)) { list_move_tail(&class->lock_entry, &pf->zapped); hlist_del_rcu(&class->hash_entry); WRITE_ONCE(class->key, NULL); @@ -4822,11 +4815,9 @@ static void reinit_class(struct lock_class *class) WARN_ON_ONCE(!class->lock_entry.next); WARN_ON_ONCE(!list_empty(&class->locks_after)); - WARN_ON_ONCE(!list_empty(&class->locks_before)); memset(p + offset, 0, sizeof(*class) - offset); WARN_ON_ONCE(!class->lock_entry.next); WARN_ON_ONCE(!list_empty(&class->locks_after)); - WARN_ON_ONCE(!list_empty(&class->locks_before)); } static inline int within(const void *addr, void *start, unsigned long size) -- 1.8.3.1