Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1974556ybl; Thu, 29 Aug 2019 01:33:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqx3nuCQ0MSWUs9voTJ9j8BFXVXu9CGqir2aG6HZ/IzwtdjfkeeQ3XLEztnnsz0Mac+fvxZ1 X-Received: by 2002:a17:902:b40c:: with SMTP id x12mr8593972plr.81.1567067596009; Thu, 29 Aug 2019 01:33:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567067596; cv=none; d=google.com; s=arc-20160816; b=xW8vw/yVme9Ba0D1E6ZhB5ti/Hi1c0lIAVTpBQXH+UES2VmEbCRRWAaoWguAIZreGG wvqU2tlvWWSGJjY/cP7oXwikxYlpWSmKIJZkY6dKJr46aeoVXf8vKN08tBVGKoqPfKjW mESouplQItRIhrMGOf79ozUQkH7eIUbWIxGCBHHl99K4d7CIWA0JJA1RfsvMDZO3UnFR 5ZDH3G3q52xnUcDDdQp8tc0BB4UoJmXiappq4LRpx+yRF5/xHSAHIMQn6CtRtlbTyAKA oTrRPzBC2IxGpPhYNQMCINQaXIDwxfwCpmKbEPdnML1U4kpD7o+gb8sOKko9k5JJ3rmt RK5Q== 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=TkzTBcVpZa2pxLJ2bxAvVhbFsL+5xrEmIrdNVlXt1l4=; b=FGoonggpltRL7W81aexG5UjkTKBQfUkwTt3ddjhgYUB+fP+QTqf5Fe/STXjgTdLcg9 IC/wSNzuKt/XQUQvqepN5mx8xHR8bTGLHdK2nKLigiazetKWEqfKZ3q2OL3nvN6ECWjH z8twDDL9DdK49/1O9K9ErIOHVPiSirXz83F4QQq8tnHciirI5hioZTpjginqK82bAxsN u7+W4iOTf1WzYbe+x3QWDpBjcNk8KUXXuAh+zGnKx66WDsi2DBeSlTSzBLKZGi037FSS 0e4XaeMjhJj/Iug8+hMgWvVf3sgojkLyCaBubWzHpitB5hJowQrodzfT5AwGwvbRcLYi 2AVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Cre7Bo7X; 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 b26si1371250pgw.564.2019.08.29.01.32.59; Thu, 29 Aug 2019 01:33:15 -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=Cre7Bo7X; 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 S1727069AbfH2Ib6 (ORCPT + 99 others); Thu, 29 Aug 2019 04:31:58 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:42845 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725776AbfH2Ib5 (ORCPT ); Thu, 29 Aug 2019 04:31:57 -0400 Received: by mail-pg1-f195.google.com with SMTP id p3so1198493pgb.9 for ; Thu, 29 Aug 2019 01:31:57 -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=TkzTBcVpZa2pxLJ2bxAvVhbFsL+5xrEmIrdNVlXt1l4=; b=Cre7Bo7Xvf5hrNK93X8DBQfJEvIiczSsN3uRWMPmYiuRoiblSuUf7noiKiVzznOwgt 572U0w/IJ/T4Elfptw3oJuFNNN8TH41lgjXIA0IH/PQReW18EMGrgYa+rbPFV3k1BDjO CBMQ6dE4pqaNjoM9obeS28iN7Htaizhynp3WRksmPmXhPEw391WqYdbXVlywqDsLDu+k 7Lncezark+rms+6sIgikgJ7lQowh6OZX6PzCTz2w7Q0HSy2fHRdtIxvbj0Ua3EDFDEaX zRCzqDUsUXiA0jgb0D1347DLFDJtW1G2dBNOPIduCiroje8LGTquPq9U+bpX/v11lO+B edDQ== 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=TkzTBcVpZa2pxLJ2bxAvVhbFsL+5xrEmIrdNVlXt1l4=; b=kNBs9JyxmsucIJny2Yd14JCCjfSggBlIgr3/T/odZYIMmROJ6EGNw3O4hJr2v6TkyT 8H9PIOL6zOlEY+ZjkhR+SBZuA6cHSG17HWdezmeeh8/93HZxtrOk2r8bFaZ98+PceZBF o5qGYSozUTSvG6Jy22k+JzdT2IWP4Llej9ECXj72DiWo+7hClGeIznrxqL1EmNE9s8MQ +ys0dT2PZSPn2YUSJMqMLXzaT7WyEeOYYyCm/C2NY7HZy5VPCvDl51zreU42pN2dCoKD 1CrqrRHaGG0m2tj1nJudMCBP3fkBLrDiYFJPKdouwYQF49AhKIV1WcaJuZffoEmNaMNp 9J+g== X-Gm-Message-State: APjAAAWG0HkUmn7p9zovPtb/lpp3xq32mw3EOrxUWlRBPIx2QMwnlX0J RegdGDh976EXTZhkHl8zoIQ= X-Received: by 2002:a65:6709:: with SMTP id u9mr7218769pgf.58.1567067517225; Thu, 29 Aug 2019 01:31:57 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id v22sm1260155pgk.69.2019.08.29.01.31.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Aug 2019 01:31:56 -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, longman@redhat.com, paulmck@linux.vnet.ibm.com, boqun.feng@gmail.com, Yuyang Du Subject: [PATCH v4 03/30] locking/lockdep: Change return type of lookup_chain_cache_add() Date: Thu, 29 Aug 2019 16:31:05 +0800 Message-Id: <20190829083132.22394-4-duyuyang@gmail.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20190829083132.22394-1-duyuyang@gmail.com> References: <20190829083132.22394-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 Like the previous change, the function lookup_chain_cache_add() returns the pointer of the lock chain if the chain is new. No functional change. Signed-off-by: Yuyang Du --- kernel/locking/lockdep.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 9c9b408..51918d2 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -2870,13 +2870,13 @@ static inline struct lock_chain *lookup_chain_cache(u64 chain_key) /* * If the key is not present yet in dependency chain cache then - * add it and return 1 - in this case the new dependency chain is - * validated. If the key is already hashed, return 0. - * (On return with 1 graph_lock is held.) + * add it and return the chain - in this case the new dependency + * chain will be validated. If the key is already hashed, return + * NULL. (On return with the new chain graph_lock is held.) */ -static inline int lookup_chain_cache_add(struct task_struct *curr, - struct held_lock *hlock, - u64 chain_key) +static inline struct lock_chain * +lookup_chain_cache_add(struct task_struct *curr, struct held_lock *hlock, + u64 chain_key) { struct lock_class *class = hlock_class(hlock); struct lock_chain *chain = lookup_chain_cache(chain_key); @@ -2884,7 +2884,7 @@ static inline int lookup_chain_cache_add(struct task_struct *curr, if (chain) { cache_hit: if (!check_no_collision(curr, hlock, chain)) - return 0; + return NULL; if (very_verbose(class)) { printk("\nhash chain already cached, key: " @@ -2893,7 +2893,7 @@ static inline int lookup_chain_cache_add(struct task_struct *curr, class->key, class->name); } - return 0; + return NULL; } if (very_verbose(class)) { @@ -2902,7 +2902,7 @@ static inline int lookup_chain_cache_add(struct task_struct *curr, } if (!graph_lock()) - return 0; + return NULL; /* * We have to walk the chain again locked - to avoid duplicates: @@ -2913,10 +2913,7 @@ static inline int lookup_chain_cache_add(struct task_struct *curr, goto cache_hit; } - if (!add_chain_cache(curr, hlock, chain_key)) - return 0; - - return 1; + return add_chain_cache(curr, hlock, chain_key); } static int validate_chain(struct task_struct *curr, -- 1.8.3.1