Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp586543yba; Wed, 24 Apr 2019 06:27:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqzH04/D8rdBuqsnkVe4Swv4N8MmMiII35hVCxbU/PT6nC4i45gEr4/TaQ3c+rLTgIyNw2an X-Received: by 2002:a65:5304:: with SMTP id m4mr6401492pgq.281.1556112466142; Wed, 24 Apr 2019 06:27:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556112466; cv=none; d=google.com; s=arc-20160816; b=ZcXD9fpT6IoFpFne4RU4jKIqZV8VkUuGcW5eWZtpak/euTp2zavpu7USQWN31oaZnJ DH2z4mdJ7n209Aeylrw7L9CQKfdERMkEm+RK0h40xSy2BopSddwifR1E2n21QyioDXgw T45wGnVdihx4zD3A0jnIia+lwHVkXepzNBE+gPI195WPlByp1X6ZIkHyCXHBuzaj2FSG gB/gRX+umn97e1diDCOrIgr+AV+Lu68u2+x0UKU5T98XFKD/gbIizUloRCzbXSIFFGOt wuFTe1TxW/2zEazoHz6iBY33ii1EvkfmVFwKShSxxg7j43+4Avda3TF6XGCijkta0YKm TFSw== 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=iDCj3vcYJ2ba6ECukipCJlwQYuaJnMKHKn0JgJNY2Z8=; b=e9j7p0oVm9wcvVN4Li9Fzpx1oNbpDrInwBNd8ckUFP022RE6x1tEprj9bPU1upCHIe fvqtR4HthIcmlnvXgRwYzLm+jH20rQPJTlAnM1yP8Rk3WGu7UnL/yphUWxgdbkW/9IAo ItJYz+mvABy1Elk4w6IdnRh4UkaniV5NTyzrUEEoPnNv2XQUd5hUU0BBg8LyKUEI5G0W 0zIazTTY7A693zgs1LNaJa0neJbq8u+NdjQ69ZvUXQ6NAvuXQ2eIlRwwRtuPz6Vof5Ie XeaCXb891LMh5lkFjgPXj47LwXkyxr/z/7562m008uOBO0LcI5+a0D6xqYq0rw/eud9u CX7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UTVzgqPC; 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 m1si17037456pgh.8.2019.04.24.06.27.30; Wed, 24 Apr 2019 06:27:46 -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=UTVzgqPC; 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 S1729867AbfDXKVw (ORCPT + 99 others); Wed, 24 Apr 2019 06:21:52 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:39501 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729836AbfDXKVs (ORCPT ); Wed, 24 Apr 2019 06:21:48 -0400 Received: by mail-pl1-f195.google.com with SMTP id e92so7285600plb.6 for ; Wed, 24 Apr 2019 03:21:48 -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=iDCj3vcYJ2ba6ECukipCJlwQYuaJnMKHKn0JgJNY2Z8=; b=UTVzgqPCPEmf//BD3SkIj838oTmXB4U6v1tISa/DwaP8JlbMEKUoxf6ZASLwWs0iWe +Zj2ueMi/tjejX3ZxsFDhUxIFbQtqTfFDp+dlUKOpHDSE2MEh3tb9084qUOyOxv96tS0 NH8lZ4Svp/logoEakFBHzoQDtWJdfuCfhRDwUUUYlM0t4pNH40qkJDkbVQQVAfmh/xRc IgwTK7iF/obULiCzQpb8esPG16QdQUmwSLikXGfg/WyCRP/wJ+efclXFSBhxaFGFagqw LKFm/TncytRXwtQAK5RwAnT067T+vZRf4wOuSYQU/AlGgshYwkFzDyyaNJ4ukRNogXx3 nnkw== 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=iDCj3vcYJ2ba6ECukipCJlwQYuaJnMKHKn0JgJNY2Z8=; b=JcxbBKjnRxTWA+FFkPWtCplX+6hj/BKuNAASIMDxm7NR+obcUoSU1YrRv0LeAPUz2M NugtDztO6me37gqHuFdr071bNza3psThENXFOATCjeO5KwMNRwNu1CNU58yfWmaB1C47 cnrKeughg0OBUeFl2LCNDly0aMeN3LufKMwwv0XU59hjMjEwENKvXzkSro1JvDyiIMCn m89O0uuDyZwSDDtF6r/Avk1tsEgIsZGzq6ibVjAGJlX0PmTw24js8+e9PxET6NmqT8Ko fYFwJlCecq6WbEkqCsDf0wWcgHUVnRBvHAeDItpn5PCPGAkxinL5lypaWP6zK3GWsqb5 gMmg== X-Gm-Message-State: APjAAAXGsKVJvMDSOWLX2hBcUz36FA9jqP8SHkJZk2Kwytri7MnZaw2G 5VQ2FjEv62jyKoffLw8klG0= X-Received: by 2002:a17:902:b617:: with SMTP id b23mr29988632pls.73.1556101308405; Wed, 24 Apr 2019 03:21:48 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id v19sm25051604pfn.62.2019.04.24.03.21.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Apr 2019 03:21:47 -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 26/28] locking/lockdep: Remove __bfs Date: Wed, 24 Apr 2019 18:19:32 +0800 Message-Id: <20190424101934.51535-27-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 there is no need for backward dependecy searching, remove this extra function layer. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 40 +++++++--------------------------------- 1 file changed, 7 insertions(+), 33 deletions(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 06ae87f..acaa3b3 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -1393,27 +1393,13 @@ static inline int get_lock_depth(struct lock_list *child) } /* - * Return the forward or backward dependency list. - * - * @lock: the lock_list to get its class's dependency list - * @offset: the offset to struct lock_class to determine whether it is - * locks_after or locks_before - */ -static inline struct list_head *get_dep_list(struct lock_list *lock, int offset) -{ - void *lock_class = lock->class; - - return lock_class + offset; -} - -/* - * Forward- or backward-dependency search, used for both circular dependency + * Forward-dependency search, used for both circular dependency * checking and hardirq-unsafe/softirq-unsafe checking. */ -static int __bfs(struct lock_list *source_entry, void *data, - int (*match)(struct lock_list *entry, void *data), - struct lock_list **target_entry, int offset, int index, - int distance, struct lock_class *safe_lock, bool reach) +static int __bfs_forwards(struct lock_list *source_entry, void *data, + int (*match)(struct lock_list *entry, void *data), + struct lock_list **target_entry, int index, + int distance, struct lock_class *safe_lock, bool reach) { struct lock_list *entry; struct lock_list *lock; @@ -1429,7 +1415,7 @@ static int __bfs(struct lock_list *source_entry, void *data, goto exit; } - head = get_dep_list(source_entry, offset); + head = &source_entry->class->locks_after; if (list_empty(head)) goto exit; @@ -1443,7 +1429,7 @@ static int __bfs(struct lock_list *source_entry, void *data, goto exit; } - head = get_dep_list(lock, offset); + head = &lock->class->locks_after; DEBUG_LOCKS_WARN_ON(!irqs_disabled()); @@ -1475,18 +1461,6 @@ static int __bfs(struct lock_list *source_entry, void *data, return ret; } -static inline int __bfs_forwards(struct lock_list *src_entry, void *data, - int (*match)(struct lock_list *entry, void *data), - struct lock_list **target_entry, int index, - int distance, struct lock_class *safe_lock, - bool reach) -{ - return __bfs(src_entry, data, match, target_entry, - offsetof(struct lock_class, locks_after), - index, distance, safe_lock, reach); - -} - static void print_lock_trace(struct lock_trace *trace, unsigned int spaces) { unsigned long *entries = stack_trace + trace->offset; -- 1.8.3.1