From nobody Sun Feb 8 12:58:11 2026 Received: from mail-oa1-f44.google.com (mail-oa1-f44.google.com [209.85.160.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E28EF28CF5D for ; Tue, 6 Jan 2026 14:27:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767709635; cv=none; b=qKEfo0RePPSXVa1DO+Ll84sHaRSyteKwOWXbQN9DLJ2i2FlKIM5RB7zydGV24spflgOjlRBuGspElMgwFw/9pmyjoYmgMsDReJS1NsVsVUtPiKfx8KxZg1P92nAzx8hM0SsIrkyQRFeBdeHISzqgBwDr5cmdyN4cxZYqAu8EIWE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767709635; c=relaxed/simple; bh=vV0mvS4Jnm2xZ3ntnOC7IJN7wlIZlMsfOIIsKVUA/to=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=f+URAKVH6FB6j+6w+g9oxPDiSZA/ChXeN5zfL66P4G3LoSStSd0BByprr9NQK9rLXH8H/7o4JGViQwkkUWffSlDn26Rg8jYJm5N2Ntr6K3n4k4uLmA+jvJ4ULlnI27rkFxpcW/m5tR2mhhEDlwPOnDXOVj3dRz2Wo+2fYDH0g1Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.160.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-3f0cbfae787so709883fac.3 for ; Tue, 06 Jan 2026 06:27:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767709631; x=1768314431; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=+3qd01S9PP2+OLCSEIsQdXiiXsFMzjeQSYIxX2JGNCE=; b=qdTnE1RgivuC2OlBqVL/APqBOme6KE5f9ocwe0af52ji5TJwgDseSfcLSpehjcnI0p K4bI2xPxy+kaV/v4XzP3Nurbbat+R6Th322g8KqPu3/xDF3kr13MhvQlk0a+wWEMbSZz AyHqR4BV25uj0k8LfMvKtAAsa8+t1ayeIj9GwvMCGMauTOkjiUcEhNASGNQzA3G9qVeh Dq1cSe1R5+ETtLQa1uxvNsXAM6wL/73w5NJSQXrpPbKzL+Rja6lCvrlopKM1It5dr5tt bnKRcA5txbyhZc4LYAEl8hqsRLDk4k5bvqbwcZtjshtNU6m5RSN8e2MXnGsGqKHbnMoo xgyA== X-Forwarded-Encrypted: i=1; AJvYcCVzrDZtIYnR9SIxbfju4+YAjireHU9H0ETEmoQc7GNMT8q1ycyILgXkxdvS0PuKIyoba5j3seiLzKS5Uik=@vger.kernel.org X-Gm-Message-State: AOJu0YzgIx/3zwiZD+dLdyphx6cmFDWTwSLL5JdabqZMVlTp2Y97Q8Bs uJI3bx2cK8ihRk6bjomUmJMx4Y2JXgrD74mjD49lb80QlOtlNyMsAfE+u49juw== X-Gm-Gg: AY/fxX68TEEHCA3FLD2AmqER7fhrCGYn2Ss45LElgnXNjmnUIWcwV7ZKTqQlNZZzB0i 2TLadZj8vYb0KAySBcSEa9pYUhUnDNgatZZIlJ8tDhM3lyQ4rbLGkZ6pL6dtXlYtymcGYwLtmv0 y/96o6myD3MAAZ5OqP4sGWBVZBeJ7DSdGLNEMFJ6Brq9+sSpdDiKTk1W5wz77wVmmlaPzCfmDHx +k6NSEL9+cYGhi/6wlwDNVHMxRcteKfva4goXgTqxEdV2irh0j2/uElZYbPk1vPb5eJVcHaErUD IWb52uM0nyulu8SUOj8f+HZWNZeC7BdwH92aLLy1gUD1cxcMuiKD2+SofeXuguIlJjjdiSTrVRw 8a+L96cUSdsn7JZ7DCR70ft7flt3PNQc/5MIAcFnJ7ozq6nO5Azu6s13pFPI4L8AThuOQEdITeH DqqxCGkVOh+TsTTbwoVKhb/dpK X-Google-Smtp-Source: AGHT+IED2Gwv/rYRU8OuPikMe18KRTzt/416cCB+x5CYYikPcYVGf68I6GEJ88NpybGUFPEiq8Dqew== X-Received: by 2002:a05:6870:f14f:b0:3ec:3b3e:4f38 with SMTP id 586e51a60fabf-3ffa0c6b5cemr1746241fac.36.1767709630794; Tue, 06 Jan 2026 06:27:10 -0800 (PST) Received: from localhost ([2a03:2880:10ff:52::]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-3ffa4deae43sm1394643fac.1.2026.01.06.06.27.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jan 2026 06:27:10 -0800 (PST) From: Breno Leitao Date: Tue, 06 Jan 2026 06:26:57 -0800 Subject: [PATCH] blk-rq-qos: Remove unlikely() hints from QoS checks Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260106-blk_unlikely-v1-1-90fb556a6776@debian.org> X-B4-Tracking: v=1; b=H4sIALAbXWkC/yXMQQqDMBAF0KsMf20gEUkhV5FSTDq2U0NaEhVFv HtRl2/zNhTOwgWONmSepcg3wZGpCOHdpRcrecIRal1bbbRVPg6PKUUZOK7KcteE/ma90Q0qwi9 zL8vZtffLZfIfDuNxYN//YPdCanAAAAA= X-Change-ID: 20260106-blk_unlikely-6ea4cf76b104 To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, tj@kernel.org, josef@toxicpanda.com, kernel-team@meta.com, Breno Leitao X-Mailer: b4 0.15-dev-47773 X-Developer-Signature: v=1; a=openpgp-sha256; l=3757; i=leitao@debian.org; h=from:subject:message-id; bh=vV0mvS4Jnm2xZ3ntnOC7IJN7wlIZlMsfOIIsKVUA/to=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBpXRu9Fd50a83G9ZgMg3oXgeowUcIVdLtQ5P3j6 S7if+yCV42JAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCaV0bvQAKCRA1o5Of/Hh3 bdzHEACnvGlRYnTRfUQaQ60ZDw2d/qcHz7HXgSyPHC04T9R93ajP3iDb1b8TH+sr8gTgl5iKLrR RYAYSkdBIKHIFGapj9U57zkR7c3Cc/n1Y4hVukG9ZwStFSWYXSDCpdr6NGOzOw4tHVYjDHGwiHA VsmzU8bJSIJnQtX5ynBRikqhW2+90hGzesTST9tXgv/sDC/yyFdYWvgvPouQLq++TIfL0p9nvn9 gVZioVm1DJQn+17ba9Ga5qmpTzpmcEwQ8b5IiCfN8lVkm7nbCsx8cfASlhxODTlRPxfRTrILOpL +N0KrnS4dE4yvMZd7uzfUVAMsOfFcYgjeed+Gc/rmM1zcIz9zo7dvhIB7X+zIQ/1zDUrqm3TXMa GphO91GEk/ZU93mRYY7uCQsB672NZVDtMLCsT9qlo+t24i9a0+Nbryjc14FL4Xc4cyPB/AgEhvc HyOCEk5U/zNrIIxXFRGtrFpgIxlWAMeMzZvY5tS6VbZc9F8ssc0OhSshgMbRScpbtSvv73OvgXM 6HeoWG3pjXV/PYTB2jGwIYq5Jzo6iYWHpSR2XW+EHO1/O/w0trqcBjYNXt0h5pB1ec19WD9y3M9 6RAewEepqt4MbierniH4rXvLbx+29vOVu770Lbwod8QO/DZXh1VIkev1OOULI/D6c7TQPEBfpSF MU2Oo3+pAecEAUQ== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D The unlikely() annotations on QUEUE_FLAG_QOS_ENABLED checks are counterproductive. Writeback throttling (WBT) might be enabled by default, mainly because CONFIG_BLK_WBT_MQ defaults to 'y'. Branch profiling on Meta servers, which have WBT enabled, confirms 100% misprediction rates on these checks. Remove the unlikely() annotations to let the CPU's branch predictor learn the actual behavior, potentially improving I/O path performance. Signed-off-by: Breno Leitao --- block/blk-rq-qos.h | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/block/blk-rq-qos.h b/block/blk-rq-qos.h index b538f2c0febc..a747a504fe42 100644 --- a/block/blk-rq-qos.h +++ b/block/blk-rq-qos.h @@ -112,29 +112,26 @@ void __rq_qos_queue_depth_changed(struct rq_qos *rqos= ); =20 static inline void rq_qos_cleanup(struct request_queue *q, struct bio *bio) { - if (unlikely(test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags)) && - q->rq_qos) + if (test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags) && q->rq_qos) __rq_qos_cleanup(q->rq_qos, bio); } =20 static inline void rq_qos_done(struct request_queue *q, struct request *rq) { - if (unlikely(test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags)) && - q->rq_qos && !blk_rq_is_passthrough(rq)) + if (test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags) && + q->rq_qos && !blk_rq_is_passthrough(rq)) __rq_qos_done(q->rq_qos, rq); } =20 static inline void rq_qos_issue(struct request_queue *q, struct request *r= q) { - if (unlikely(test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags)) && - q->rq_qos) + if (test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags) && q->rq_qos) __rq_qos_issue(q->rq_qos, rq); } =20 static inline void rq_qos_requeue(struct request_queue *q, struct request = *rq) { - if (unlikely(test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags)) && - q->rq_qos) + if (test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags) && q->rq_qos) __rq_qos_requeue(q->rq_qos, rq); } =20 @@ -162,8 +159,7 @@ static inline void rq_qos_done_bio(struct bio *bio) =20 static inline void rq_qos_throttle(struct request_queue *q, struct bio *bi= o) { - if (unlikely(test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags)) && - q->rq_qos) { + if (test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags) && q->rq_qos) { bio_set_flag(bio, BIO_QOS_THROTTLED); __rq_qos_throttle(q->rq_qos, bio); } @@ -172,16 +168,14 @@ static inline void rq_qos_throttle(struct request_que= ue *q, struct bio *bio) static inline void rq_qos_track(struct request_queue *q, struct request *r= q, struct bio *bio) { - if (unlikely(test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags)) && - q->rq_qos) + if (test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags) && q->rq_qos) __rq_qos_track(q->rq_qos, rq, bio); } =20 static inline void rq_qos_merge(struct request_queue *q, struct request *r= q, struct bio *bio) { - if (unlikely(test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags)) && - q->rq_qos) { + if (test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags) && q->rq_qos) { bio_set_flag(bio, BIO_QOS_MERGED); __rq_qos_merge(q->rq_qos, rq, bio); } @@ -189,8 +183,7 @@ static inline void rq_qos_merge(struct request_queue *q= , struct request *rq, =20 static inline void rq_qos_queue_depth_changed(struct request_queue *q) { - if (unlikely(test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags)) && - q->rq_qos) + if (test_bit(QUEUE_FLAG_QOS_ENABLED, &q->queue_flags) && q->rq_qos) __rq_qos_queue_depth_changed(q->rq_qos); } =20 --- base-commit: c92f16e43c48f367af2f63956eb8385cb05816f3 change-id: 20260106-blk_unlikely-6ea4cf76b104 Best regards, -- =20 Breno Leitao