Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1874745imu; Tue, 6 Nov 2018 05:47:55 -0800 (PST) X-Google-Smtp-Source: AJdET5cPPpWUOlcH9Hv1G7pexu2SYjcyAuvx7PJWsJhnOUDxV655aJsTp3somc7aEkl8e6ncvqof X-Received: by 2002:a17:902:bd0a:: with SMTP id p10-v6mr25599566pls.245.1541512075076; Tue, 06 Nov 2018 05:47:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541512075; cv=none; d=google.com; s=arc-20160816; b=Ck9FIhv79nwU285rHaAsvAWtCkUkjmWlJed6L60YPTb3DsdgUxHSHMwKQl3XqP4DLr axwSC2OaxrW0I3/v3Skn+nVqHhFv0jRlJLlxq5cE0f3EEPXOWo+Qyczikx7rDbgXVja5 xHOBMpc1yHrFda6dIivGSNwQ5/HJE1eB7aMmWtBuYFiT5NpoI3awF8pQb29Z8kglZaTb VsllIj4anpsDK2hi6QpTBC/6fQZocf1gopox8gbILdQG/UmElNvhE9PP6NOOvfQrUxcj 6KLCNxGp1R5OJFS+0fZ+dAmrAE0t2rbRTaV12UiQ8lDeQvRzSYdkkQzlfcw72u0H8KC0 k3sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=pTESJ2/S8dzaTzkVSOvuQhE3I6U09WoCR1Pwcr4kIPA=; b=wfERggWqx983H6wDxKfD5kSy5ehHqqoCYZItEKbxaXuoI/yMKRN9kqw9REBfMExRbt M6jLgwLvqA+27MxJZIHUxFw+WPXe2jnMsfopWsNZjw4VxLpXHc4BE+0OcgKywEHz7avt A/Abuwj86qYvDO1VwNzBVqifq7XYFt4aLVHOOBdy1WIPXROZq9utrDipFXaoc3udezju EeSmzqCxI/fLEu8oJZz8gaL/0yNkcrholUEz/KAHYdUx5YAIgtMiJsckiVIFSgj2p4gT P6QbjzYEdxGiPOMMd2IiZl97A1TTyTZc+DDNZuhV1Nx5DT7MD5Z3eYX6MoMSPztdc/cc 2cTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LpqQZGpQ; 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 u8-v6si39776733plh.188.2018.11.06.05.47.39; Tue, 06 Nov 2018 05:47:55 -0800 (PST) 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=LpqQZGpQ; 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 S2388334AbeKFXM2 (ORCPT + 99 others); Tue, 6 Nov 2018 18:12:28 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:36800 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388048AbeKFXM1 (ORCPT ); Tue, 6 Nov 2018 18:12:27 -0500 Received: by mail-pg1-f195.google.com with SMTP id z17-v6so5848687pgv.3 for ; Tue, 06 Nov 2018 05:47:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=pTESJ2/S8dzaTzkVSOvuQhE3I6U09WoCR1Pwcr4kIPA=; b=LpqQZGpQW3f/IF+D90SKDGQ3EhLUDrw1Ne1ftHNFYyV1XylcGmyId25zw36Jr/wl25 7DDplKLzwptMTqCEondnZomyxMf8x8evaYa8pPna1QuwZRfTJPYiFScTcOrh2Jf3aITZ FNmPKM/r8d2n0Dgasg43agww5YdiLNea523whBV39NfjDqvT1jXxtbeb2V3b1Q0wkNp7 5NVAWPmUM8YsxF46+sxfreFiJPkWmadOe0lV6FLrA1LgQC/2XFD2RKgdGkpXGdWERcew 7pDSnp1eVJVckzutvoBeq4CiD9o3s2wmWj7Ozbq7k+zMONF6hOfXA8drE0lspw4HMXFj uBSQ== 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; bh=pTESJ2/S8dzaTzkVSOvuQhE3I6U09WoCR1Pwcr4kIPA=; b=GfJN5FcIiAMc//sMYw/PU/0Pal6QTGtlRDqn8qCyW7X5y0kESrhyKzXhl8qZmc0PSW vpdleUf0MuqA7swW6Ju2TNU62YpyXiw65hMN/PvyOYVZouA1mUZy84ywQTxs3uJEyPmK Nd3W0uHB0A2dL7ZjQ3rncjTGVNE/LypVnnvCRSTYF2FN+w+LzXm4ujJ3XeSzFN+fhTy7 DNDTAmrFFc+EIbbg/8bHsJtCT8ZNkGG3KsvqbHgWUW9lwf0z6PwUaYdJLgO5/pRyUY51 pqSHFl/Z/q1K1KyNFNc/rzrcelEnfLECltu06KF/9Izm2yzXm5Xjxd208YD5rGgNh4vN 73nw== X-Gm-Message-State: AGRZ1gLRccS+KGHPDhuLMBJ1t/OgPqpG+hhYlYNstd+BeVmg+BVCCd4c vXJSNtEOpnGuV5/VMFVGG5o= X-Received: by 2002:aa7:8498:: with SMTP id u24-v6mr26236256pfn.220.1541512028637; Tue, 06 Nov 2018 05:47:08 -0800 (PST) Received: from localhost.localdomain ([104.238.150.158]) by smtp.gmail.com with ESMTPSA id h62-v6sm70127432pfa.146.2018.11.06.05.47.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Nov 2018 05:47:07 -0800 (PST) From: Muchun Song To: gregkh@linuxfoundation.org, rafael@kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH] driver core: Add branch prediction hints in really_probe() Date: Tue, 6 Nov 2018 21:46:30 +0800 Message-Id: <20181106134630.29591-1-smuchun@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If condition is false in most cases. So, add an unlikely() to the if condition, so that the optimizer assumes that the condition is false. Signed-off-by: Muchun Song --- drivers/base/dd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 169412ee4ae8..8eba453c4e5d 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -450,7 +450,7 @@ static int really_probe(struct device *dev, struct device_driver *drv) bool test_remove = IS_ENABLED(CONFIG_DEBUG_TEST_DRIVER_REMOVE) && !drv->suppress_bind_attrs; - if (defer_all_probes) { + if (unlikely(defer_all_probes)) { /* * Value of defer_all_probes can be set only by * device_defer_all_probes_enable() which, in turn, will call @@ -508,7 +508,7 @@ static int really_probe(struct device *dev, struct device_driver *drv) goto probe_failed; } - if (test_remove) { + if (unlikely(test_remove)) { test_remove = false; if (dev->bus->remove) -- 2.17.1