Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6462659imu; Wed, 14 Nov 2018 01:44:32 -0800 (PST) X-Google-Smtp-Source: AJdET5deF4jKoqeNvyG9V0CdxJUiYdEd8zFNE7keFs3j5TtWimQEaoej3Z2j9pa3ijdhK71bRk25 X-Received: by 2002:a62:4bc2:: with SMTP id d63-v6mr1292617pfj.170.1542188672601; Wed, 14 Nov 2018 01:44:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542188672; cv=none; d=google.com; s=arc-20160816; b=MaIU6W9u9L3Wmg3A7WoAcPBcJLYipqYwOc4Im7Cd7czThpLRQddcBrXjY5DnTU0fAy RDysxeoRzMWfiRE7oTnmsGB3NVYbVy0WwNdeWv7DseYnNjEQCmBRoWopjEX+jxlk7O82 B0m4fOvomtVNtG02vXAaE1LJ7wH+wX9egqYP/P0PFXKiZa26+bwk3pxUVEkmug/6P6A0 g26ApejVeqHPRJ0tJ1wOGY8E6m8Q62LcW5BYIXEqDSZFU0IynaF7qigDX4ad+ERl3F7K jjP+/BrMjXas7EDTjMx7npJXK+ZzXsyo/TVniWe+KMaAZGatiWfnPB5djrOmlQP2xKtJ otxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=aKaPQ9kpiUxl3L1yvUDOLOxDZO46Sdze3y6cmWapc9E=; b=mSFGDRxBWCZUzYF1zK8MlvJn54joz+0Qew3fnYDDmNlTPJGngNo6kZL7Yvdc9r/bwU xsL75mw2zSvfctQc4F6JGu2raxzwuiI/6gsmHILadenA85ZPbuif+8iEViEd2g3049v5 GB15PW8bAFDouD77O58NdaCOfW7+dB7et+5nPJ3qurt9ja2cuTk7c9qe/XmXoB0o5sCF BlFawalntHxBjl+Zn/wn3/kHJMEtySyxwo+JWIFbVy13l2nJtkv5VJYf3OmWFTCH/VR/ 0k3Jm0794TH2IyaVLoreah3TABwLw2GGALOH77L9rDxwQrRkTNJi5xczRrmGXRe/miBz mC2A== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si2331166pli.346.2018.11.14.01.44.16; Wed, 14 Nov 2018 01:44:32 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732121AbeKNTqZ (ORCPT + 99 others); Wed, 14 Nov 2018 14:46:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39624 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727558AbeKNTqY (ORCPT ); Wed, 14 Nov 2018 14:46:24 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A79D689AF9; Wed, 14 Nov 2018 09:43:55 +0000 (UTC) Received: from ming.t460p (ovpn-8-18.pek2.redhat.com [10.72.8.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C47D15D9C7; Wed, 14 Nov 2018 09:43:49 +0000 (UTC) Date: Wed, 14 Nov 2018 17:43:44 +0800 From: Ming Lei To: "jianchao.wang" Cc: axboe@kernel.dk, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V7 1/4] blk-mq: refactor the code of issue request directly Message-ID: <20181114094343.GA13193@ming.t460p> References: <1542185131-15029-1-git-send-email-jianchao.w.wang@oracle.com> <1542185131-15029-2-git-send-email-jianchao.w.wang@oracle.com> <20181114091153.GB20550@ming.t460p> <17b51550-d45b-9861-b172-74ee0e256d98@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <17b51550-d45b-9861-b172-74ee0e256d98@oracle.com> User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 14 Nov 2018 09:43:55 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 14, 2018 at 05:23:48PM +0800, jianchao.wang wrote: > Hi Ming > > On 11/14/18 5:11 PM, Ming Lei wrote: > >> > >> - if (!blk_mq_get_dispatch_budget(hctx)) > >> - goto insert; > >> + if (unlikely(!blk_mq_get_dispatch_budget(hctx))) > >> + goto out_unlock; > > The unlikely annotation is a bit misleading, since out-of-budget can > > happen frequently in case of low queue depth, and there are lots of > > such examples. > > > > This could be good for the case for no .get_budget and getting budget success. > In case of out-of-budget, we insert the request which is slow path. In case of low queue depth, it is hard to say that 'insert request' is done in slow path, cause it happens quite frequently. I suggest to remove these two unlikely() since modern CPU's branch prediction should work well enough. Especially the annotation of unlikely() often means that this branch is missed in most of times for all settings, and it is obviously not true in this case. thanks, Ming