Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1925849imu; Tue, 6 Nov 2018 06:31:16 -0800 (PST) X-Google-Smtp-Source: AJdET5eZBaSYheCxSC86eVeXuGvsj8x20Yu1NmxwptXYooseg79WoTPuf6eBtVBoVq2gNZIGBcgb X-Received: by 2002:a63:5f41:: with SMTP id t62mr24063480pgb.76.1541514676573; Tue, 06 Nov 2018 06:31:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541514676; cv=none; d=google.com; s=arc-20160816; b=JHGdqTvqNwKYbR31dfOSle6JiNNo8CA9UnZgUhZ92T4ynbFk8WyYL0t2jt+Za17vPA dMUjxdEnauvc3UvdsHxWmS81Dcn5KU00DBkxxPYG0bBlIfiRQXeEBdXc4yhUZQ9hD7j3 erm3aeFIXJOa3xkmo27/jJhrthHWFx1znwY5ZkoocZSDspEIKMjvYUkGRujF44RdltoZ douLG16m23cXno+UoIlA5v2mWlHxP9TMjlLewqhdaTLzuTGaps8V+SyobzTqFy2am2qH YJntg05eIaYfm2FW27cyO8xs5IHhb2OLiff2SO8uw3gf4kQBJ6UNvcCmYRcRjtfeQNLY 06zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=5MeaJLuyzTj5y4S/PumqUqKqJlwAbRWxfNw+8S6qG5k=; b=M2JmccvnDU7KfMyoBHA/7VaUEOMCTEXQE3TByKRy4Tc5LqNGmL2zq5EKD5e/ECA7tH mW8KSAdiPMXH711xiXZ72yK8HIUdZMvV2iRgjhpWtT2mviF9/KElbploUw7y0ZB+iE/G ZIFSLaVMGjLn69tsbAAC8CvNPeuHZEA2UGAalHatXVLa4e/8cMSXyoZyOcWkRn/hJ07N 5LlAcNIwnfjVp6/1k3dA+xLbj50I895nQQqw4tPpBAHYPKpqmjoDCGDPK+epT24u+fnp mpvXmJQwjCpMZ/Pni8llI91I2cTRQDySj5AHHcxQhYbBK05+c2djGEKDV/mHywUYJq1X OLLg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y5-v6si41924881pgv.38.2018.11.06.06.30.53; Tue, 06 Nov 2018 06:31:16 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388782AbeKFXz4 (ORCPT + 99 others); Tue, 6 Nov 2018 18:55:56 -0500 Received: from mail-ot1-f65.google.com ([209.85.210.65]:39174 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388744AbeKFXzz (ORCPT ); Tue, 6 Nov 2018 18:55:55 -0500 Received: by mail-ot1-f65.google.com with SMTP id g27so11552709oth.6 for ; Tue, 06 Nov 2018 06:30:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5MeaJLuyzTj5y4S/PumqUqKqJlwAbRWxfNw+8S6qG5k=; b=DsBz2g+9Rj522RCD3IPbZhz0UFAnfWY/vrbX3w0R/YJqmc0+RjBpOGCwusneCEV23v q2ZscOe0ruPAHxblcgfMngQUNJVE52cgcRlm5tYDpFPS1uBueHsnwBxonCOzIcOS2wcP om7fwFvbzPFu+aWR4vhA9q9v2wNz0RV59jI6JDWJ8YDMQo9v65pujX11YzPcmtT4kzWa QDv2SwDsNwZQ7NrW9AFQQj/6+q7P+qv9wljUCioIIjxcdS0ZMbtLzu2As/oEgxzZ44fv CpnuGZXgk4C7fZNBlNx5XqXqKgOW34q8G2eKWe6DcjCAxnGn+6vYL0fKLfAWfoopH3zp 8UXQ== X-Gm-Message-State: AGRZ1gIa+vvzSGnr8DbG/PjLVShnNHM6EPW+MMTJ5/9odl0BlpBHFqx1 r+5kB7a02SaJK62CPnm/fwE8glOX/XmddfifEck= X-Received: by 2002:a9d:4c84:: with SMTP id m4mr10285128otf.124.1541514626499; Tue, 06 Nov 2018 06:30:26 -0800 (PST) MIME-Version: 1.0 References: <20181106134630.29591-1-smuchun@gmail.com> In-Reply-To: <20181106134630.29591-1-smuchun@gmail.com> From: "Rafael J. Wysocki" Date: Tue, 6 Nov 2018 15:30:14 +0100 Message-ID: Subject: Re: [PATCH] driver core: Add branch prediction hints in really_probe() To: smuchun@gmail.com Cc: Greg Kroah-Hartman , "Rafael J. Wysocki" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 6, 2018 at 2:47 PM Muchun Song wrote: > > 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 Have you measured the practical impact of this patch in any way? > --- > 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 >