From nobody Sun Feb 8 09:32:45 2026 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) (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 70B5A30C627 for ; Fri, 14 Nov 2025 23:54:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763164491; cv=none; b=GghvyN4Gise1ed0sCvzjQGi4W0sMUxUGweY8si2FVOm9GBGvPx/Cwjj3Ew3elHjYa8aQRHe3S8OLwbzXhqvlL5oC+PBT4u7wh9kVLbVeIIGbr0GE91uh7S80EXowoS1p+uNJNZrk89MoOlen75oIbRLPCnw/34cSKiXtIq0d8LQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763164491; c=relaxed/simple; bh=eZmo6/5xCexjplSdLKsWrnqHmeMVHTordQIE+X1VxUo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d41f8kFkSnElZ7qIy9k+C7XOhSYBPRWob6qg3I1IMzvzDR8xK8E2pev5tNovei/Uab/Y6ezHQBCY7fL9AyUlEbhZf1ee1Zv4yTgU46DbYLqEhS+d3ICTvT0KN48xOqe0XYtgoJBYP1euQlPUKrKkFT1Sc6y1sLwJEafG0ckyRvU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=HXRR9iCD; arc=none smtp.client-ip=209.85.215.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="HXRR9iCD" Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-bc0d7255434so1561610a12.0 for ; Fri, 14 Nov 2025 15:54:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1763164489; x=1763769289; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=A4f5r+TGOOPde/WLtRUa45GVIxXbdn1Vo4b55yI0gt4=; b=HXRR9iCD4ENjXznIuoGTr8IHj75+6u5IHRhUrtib9y946Xg5VIN5NRPwxxI/fCVPg6 V/F1L73PrHf/vD83VcnkkpY0FOxSsEUtXYY0ZEsa0Ip6cnFo8aWIugXUEhnqzrZZ6VOX yvsICP43bAt7HJqMG9DikG1YDf35gqBpq7Dmw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763164489; x=1763769289; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=A4f5r+TGOOPde/WLtRUa45GVIxXbdn1Vo4b55yI0gt4=; b=kVLQqks1jLUEz47RDza0n52dEtI1C7+5jSlog716W/aF+NxvKzvkivxW1ptQ0OA3B/ X4UqAjjGPNbIbbO9DggILddydhdqVivVYcsZEAs6yNu6UB8jMfGTqkjj0q4lcaaUTMK1 hzIru8pi9Uw6zhDFfschutrjjIqklzDqfHlxV4iAIrGfyRo9PX0ZBVDQU1nJrrSuS2NS Q4Mf1Tsni+/lIaRu2AyP80g6IgGhbHhoa1Qqm50QJY1VzztlRBaefUHjyK4cyEgrkeR1 b2GCdyiNJdXjsi96yl4R9dHzhVPk6t/rMkWd0+qYIF9tcwhCoOz/RMhzvf1LxE2D8Y3V m9kw== X-Forwarded-Encrypted: i=1; AJvYcCWcgTa75pnJaladYnHCcZFxGJsOtDfwDDfUE/O3+PJy4Xmxc1t7WsI6QqceMltr5vk9aC4RlvQ/j4IwJ9Y=@vger.kernel.org X-Gm-Message-State: AOJu0YzmZWbtf9Zc/lpkLeYKxAvg3rofNxm87NGfyvUzsBOAPpUYw7wd VZ1G5bajxPmOoyeAr/+lN/33fAAw43q9Y3NPDWZ8Ij7jYD8A6hir+5ZNEZa1XJnb5w== X-Gm-Gg: ASbGncvRYgr5Vg24Y+GjfBVlavlm0AHFEFUPdEqCSIb3DIw0aE1vk6CROCBEzfBMb3q OSBb/cwCARyFApCpyxnYOX1nsdL9G7H7S4c0nRhRoz1Cy9F3S8zyOvGBmEkfgJ5Ak3eoF2/q6+k ZDX0PgxD/UR9m6hno9o7qksME1ZpbeLoQ2BoewW/tuVul7MQYLE8QvvxfsiumT6WWR77vukvkyd 2EM8HWj7fGOoinrygS6Ul0IQUapZnJy/+0wPE4TUhh4QY8et1nmo3o3J+yU2Fr0hlcaWoaS9B0+ CVPwJWccfL/Jy12AA4RvjGxvo8uVtEuuVN0qTfH/LhmV77ydQcklSEwMewxf1JGF8pVwTcVV2s5 LIn6cMzEK708V7WMZrM9WEsjdhAelE2VHsQ0XsMV0XWZLxtS9fhvgjJcoksCFxKWa9m23dwa81m kfcDR2tqnF7icsU9Un9YJnAwm1ym/uW/2PYGnQ9zYim7q2JHFEyL4EwqeW89L9LElT0RH4bk5CA 8uaEGYrmQ== X-Google-Smtp-Source: AGHT+IFtwwfARtE+LZgjm4XpePNHmAw5KTc8Gn91NyCPCwHKkcDkm5Smf3lVi3mzi3s6gN/2LN1I7g== X-Received: by 2002:a05:693c:40dc:b0:2a4:3593:4679 with SMTP id 5a478bee46e88-2a4abd973e6mr2295298eec.21.1763164488752; Fri, 14 Nov 2025 15:54:48 -0800 (PST) Received: from khazhy-linux.svl.corp.google.com ([2a00:79e0:2e5b:9:bb76:6725:868a:78e5]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2a49db7a753sm14114818eec.6.2025.11.14.15.54.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Nov 2025 15:54:48 -0800 (PST) From: Khazhismel Kumykov X-Google-Original-From: Khazhismel Kumykov To: Tejun Heo , Josef Bacik , Jens Axboe Cc: cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck , Yu Kuai , Khazhismel Kumykov Subject: [PATCH v2 1/3] block/blk-throttle: Fix throttle slice time for SSDs Date: Fri, 14 Nov 2025 15:54:32 -0800 Message-ID: <20251114235434.2168072-2-khazhy@google.com> X-Mailer: git-send-email 2.52.0.rc1.455.g30608eb744-goog In-Reply-To: <20251114235434.2168072-1-khazhy@google.com> References: <20251114235434.2168072-1-khazhy@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Guenter Roeck Commit d61fcfa4bb18 ("blk-throttle: choose a small throtl_slice for SSD") introduced device type specific throttle slices if BLK_DEV_THROTTLING_LOW was enabled. Commit bf20ab538c81 ("blk-throttle: remove CONFIG_BLK_DEV_THROTTLING_LOW") removed support for BLK_DEV_THROTTLING_LOW, but left the device type specific throttle slices in place. This effectively changed throttling behavior on systems with SSD which now use a different and non-configurable slice time compared to non-SSD devices. Practical impact is that throughput tests with low configured throttle values (65536 bps) experience less than expected throughput on SSDs, presumably due to rounding errors associated with the small throttle slice time used for those devices. The same tests pass when setting the throttle values to 65536 * 4 =3D 262144 bps. The original code sets the throttle slice time to DFL_THROTL_SLICE_HD if CONFIG_BLK_DEV_THROTTLING_LOW is disabled. Restore that code to fix the problem. With that, DFL_THROTL_SLICE_SSD is no longer necessary. Revert to the original code and re-introduce DFL_THROTL_SLICE to replace both DFL_THROTL_SLICE_HD and DFL_THROTL_SLICE_SSD. This effectively reverts commit d61fcfa4bb18 ("blk-throttle: choose a small throtl_slice for SSD"). While at it, also remove MAX_THROTL_SLICE since it is not used anymore. Fixes: bf20ab538c81 ("blk-throttle: remove CONFIG_BLK_DEV_THROTTLING_LOW") Cc: Yu Kuai Cc: Tejun Heo Signed-off-by: Guenter Roeck Signed-off-by: Khazhismel Kumykov Reviewed-by: Yu Kuai --- block/blk-throttle.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 2c5b64b1a724..c19d052a8f2f 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -22,9 +22,7 @@ #define THROTL_QUANTUM 32 =20 /* Throttling is performed over a slice and after that slice is renewed */ -#define DFL_THROTL_SLICE_HD (HZ / 10) -#define DFL_THROTL_SLICE_SSD (HZ / 50) -#define MAX_THROTL_SLICE (HZ) +#define DFL_THROTL_SLICE (HZ / 10) =20 /* A workqueue to queue throttle related work */ static struct workqueue_struct *kthrotld_workqueue; @@ -1341,10 +1339,7 @@ static int blk_throtl_init(struct gendisk *disk) goto out; } =20 - if (blk_queue_nonrot(q)) - td->throtl_slice =3D DFL_THROTL_SLICE_SSD; - else - td->throtl_slice =3D DFL_THROTL_SLICE_HD; + td->throtl_slice =3D DFL_THROTL_SLICE; td->track_bio_latency =3D !queue_is_mq(q); if (!td->track_bio_latency) blk_stat_enable_accounting(q); --=20 2.52.0.rc1.455.g30608eb744-goog From nobody Sun Feb 8 09:32:45 2026 Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) (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 A099830F546 for ; Fri, 14 Nov 2025 23:54:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763164493; cv=none; b=QrM6fQR09J14zSo6nxaYiijAwrjemYdw5rnrpLA97R6+9AteDZS42HQyio5lRgXHyl23VhotSybLbj4s7q1ZVxgh2ra3DgnqSogf0xHjwEHBl86GLb14NnuyvBxogy3fsIZLbKGRyZrqhJ+INkFTS9nIqjGkmuGUkZw/I0Zu3Yo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763164493; c=relaxed/simple; bh=3ISK3vmEmXYxkx6L/TlERdD5sr35Uw+sM1ovYwgxP0I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q4U3dPf6BdfhZYCMWnH08CP57JTjc2LrC7bold0F2sub4Wri697XvGEiMgb9EXqKDYhw6EQUIpAGWnLe6phVCzah+krR+S1Wtn6s13Vu19yQiqQGnKeshzA+6yMLyqrHEedRADabwxnAS4FMtJhKTiiUhfysHS4bpdwUn2xNDQc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=DS9f4io7; arc=none smtp.client-ip=209.85.215.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="DS9f4io7" Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-b9f1d0126e6so1596824a12.1 for ; Fri, 14 Nov 2025 15:54:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1763164490; x=1763769290; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uFdmZz4q1tuXgiwvVFEfWPnDBWXiUNf2fULwgRSPSqE=; b=DS9f4io790OsIQQ1ObW/CGEvjd4Xxt1lt1eK4HNFtVr5b14K75C/8nS5J30rc6wyPD 0+X0bU9Wl7BC37ENdbc1ABMIu6bI7vHuJ2XrwdAzMcUfGKJeGhBx9RcGWeKEyIIcrFQw 9nhrtp5Lt6wdQChMsh6Ayf7vBmZzle0QYDOEc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763164490; x=1763769290; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=uFdmZz4q1tuXgiwvVFEfWPnDBWXiUNf2fULwgRSPSqE=; b=efXPHEUGEswripbAiNPnO67eckNXY3KhSi6+qS7D7/zhaBsmYASGKcNRfgf2GN33iT MEy9jRXWHDWw+vfN6UOKrdFHrY44BXRT6Y20zjG+k2ArutyL7oUcS1IzCeSD8YOXb/+y em6bQzgOmWpABTDZHSbTTgkvGUnycqaqzcB/uGylCA1WjNby4Gxh5HHa9B5LgtpQDzdm rBqhQATl4PeZluJ8yWprTL/S6LN8lVbokjCcHMhuR9Nf0i6Ls4TDLxMtjIbdaLYZ3bCd hf6PymqErB1p2LuJcTeKc5YeyCI+8+ihrtCoyiR9gIpz9cjXPt/JA59j6+dLrFgQUZLp d8Cw== X-Forwarded-Encrypted: i=1; AJvYcCVaG9asycVRkXLJysG3hwPLN5icEopetd8qPSdCVruw5k6jE+f9G1whjUdcUuiDNams2y/1TBRBXxJVOHM=@vger.kernel.org X-Gm-Message-State: AOJu0Yx8HaPcasSdgkbkgAUvNJLFKMVt/XP5AUq2B5cwoncLVW72YJ4u S6MokCbtyej6KfRezG41ITn6xVmf9I8iahMj0TjRsdpeJfON1lBAooneMNpKIZLPvA== X-Gm-Gg: ASbGncvgz34ST4e1nMOi/1YPjZF1wvqFZRtJKppElzA/UCVSSYOOyL0fmVl7hIvS5rZ /9E3K9IrjlZiwPVi6IrAQzzT8FqYe+0Mc8FKP4/iLg7027Hu/ZqpONGpzHm226ZtEa8zuMbTJMG 5IgF+8Ysha2o/xZGB5DbycN74VE+/3UKqDzT2gNiDoZtoa81mNPWrSHYpkASU5jpD6341bGC1nU ZwKd0gEpxRM/U8pVoJThPaLp9WhodEkYtBpmgk4CztCvfWUHkP2nBsaXDOR8QxvApfxi8UDYTbP sd3uWn8D7fBTTNpEkf2zwSESvfxBbMp4tGnsecGr6meTc12B6mnpYE0C5GHOncg1FfnC9E6ixrm +eDEMvW4UmwTtZstX4g4xGKeTk/FCmpAf1Na0ZtI4keAbpQBol1rvtQXgSHX+1jTYXvoRRRNteh rMDqVrR/cj5gOwAvBMyIzFrQIR7MMlGbVSHt6clzU0gBeBIchq+CPnyZiqPNh6pZhgliaaJW5hI MsgQstx4TrMVcmHFPZc X-Google-Smtp-Source: AGHT+IHedTwgJN/jlP+lN345ODfHCK52a3qWBMDHclzPe3MK3s/H5bCWbd4lV8zbwLxOjyRjOUEI3A== X-Received: by 2002:a05:7300:f68b:b0:2a4:3593:ccc6 with SMTP id 5a478bee46e88-2a4ab443a21mr1704630eec.13.1763164489828; Fri, 14 Nov 2025 15:54:49 -0800 (PST) Received: from khazhy-linux.svl.corp.google.com ([2a00:79e0:2e5b:9:bb76:6725:868a:78e5]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2a49db7a753sm14114818eec.6.2025.11.14.15.54.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Nov 2025 15:54:49 -0800 (PST) From: Khazhismel Kumykov X-Google-Original-From: Khazhismel Kumykov To: Tejun Heo , Josef Bacik , Jens Axboe Cc: cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck , Yu Kuai , Khazhismel Kumykov Subject: [PATCH v2 2/3] block/blk-throttle: drop unneeded blk_stat_enable_accounting Date: Fri, 14 Nov 2025 15:54:33 -0800 Message-ID: <20251114235434.2168072-3-khazhy@google.com> X-Mailer: git-send-email 2.52.0.rc1.455.g30608eb744-goog In-Reply-To: <20251114235434.2168072-1-khazhy@google.com> References: <20251114235434.2168072-1-khazhy@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Guenter Roeck After the removal of CONFIG_BLK_DEV_THROTTLING_LOW, it is no longer necessary to enable block accounting, so remove the call to blk_stat_enable_accounting(). With that, the track_bio_latency variable is no longer used and can be deleted from struct throtl_data. Also, including blk-stat.h is no longer necessary. Fixes: bf20ab538c81 ("blk-throttle: remove CONFIG_BLK_DEV_THROTTLING_LOW") Cc: Yu Kuai Cc: Tejun Heo Signed-off-by: Guenter Roeck Signed-off-by: Khazhismel Kumykov Reviewed-by: Yu Kuai --- block/blk-throttle.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/block/blk-throttle.c b/block/blk-throttle.c index c19d052a8f2f..041bcf7b2c7c 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -12,7 +12,6 @@ #include #include "blk.h" #include "blk-cgroup-rwstat.h" -#include "blk-stat.h" #include "blk-throttle.h" =20 /* Max dispatch from a group in 1 round */ @@ -43,8 +42,6 @@ struct throtl_data =20 /* Work for dispatching throttled bios */ struct work_struct dispatch_work; - - bool track_bio_latency; }; =20 static void throtl_pending_timer_fn(struct timer_list *t); @@ -1340,9 +1337,6 @@ static int blk_throtl_init(struct gendisk *disk) } =20 td->throtl_slice =3D DFL_THROTL_SLICE; - td->track_bio_latency =3D !queue_is_mq(q); - if (!td->track_bio_latency) - blk_stat_enable_accounting(q); =20 out: blk_mq_unquiesce_queue(disk->queue); --=20 2.52.0.rc1.455.g30608eb744-goog From nobody Sun Feb 8 09:32:45 2026 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) (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 E2A3430FC22 for ; Fri, 14 Nov 2025 23:54:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763164493; cv=none; b=gMvGmu1KSUB/bcTgzdwiqo0fsUyJsQtIyhfyp9Ll3rs8VaW1FkDgcaES49p1cyQ4Rs8HUsliKnfl72LaAcph+zew/6krqNMpyqhYuLZEQ37v1tZKf5tFYScyZ6548536ZBeKlk7s752Hgc7eMq66ASTcuYFAyhko2Trmq99B40c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763164493; c=relaxed/simple; bh=ZLJRDtmMTSR2hBThTLrxeqF6jTJw2BnwyDiG+k52hmQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dBxAybK3KF21oNDVDHOLmqfjcCnCCWZ/MKVIeIZ1EJAlDlac7P+1OJbvKfFwSYPQaLT8s3g5Gbi741d8/QZkPz7emHx//4eafpbrhy0xBczxGMa+aQnvAdwJoKlaWvOF02Xb3/1bCwdRBWBvcsDeJOEUbPT3AMjFiiLps+5tCQY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=gGLgwHAQ; arc=none smtp.client-ip=209.85.215.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="gGLgwHAQ" Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-bc7665af914so757978a12.0 for ; Fri, 14 Nov 2025 15:54:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1763164491; x=1763769291; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2lAexgWc5Rcvg5lyc1le6j9r+USga7BCC8BjTHR1o00=; b=gGLgwHAQIxSenfZSrhHYNYfQlm7im/DNkz8ns7NzzxV7WITPBCDhqJ9o4TOMg8wa0X F/hWNq7cHU6ANqqY0CioBRz5S+6ygzZ0EN752UDm9HACZftOEFsUuvn45XOTRfXdfY+6 Fo663sT5GAqV6rD++hgkK3rMKxi1cVDCJLdVk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763164491; x=1763769291; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=2lAexgWc5Rcvg5lyc1le6j9r+USga7BCC8BjTHR1o00=; b=DktfUdaSra8UP1UIceqTki0Gs1hRHJk9hNkeke4Wp8zyrAahAfcSUY+ViRNVr/3lQk ge7lhLWEeN58eAu52JntbSWQyVtSMznShoJxCdjeDOi4tq2bJv+Nhh9gQCzlzv1iFAZw xLAg2Yjej/6MzaXAw+sh298icS4gzruGgSHQDwRv/sj7a5FkjagUDis0Xrp/oBMHreVy FWRrTcnFUo/bvn8BpfPHqvzBNQdsGIL752y7bWw71TnzVhcDHynjg+raCF2WgMckZRv3 Z8TBoZ1qYl7m/9gGz+PMtYoqI30BBe8/3O8spmFu1TX9PuDz31Aj0uIaoM2nSJ3XpPMV FUxQ== X-Forwarded-Encrypted: i=1; AJvYcCXPaX55j1KoQgSarrKwLFpWo9dfVmFKq4CcPCFH+7J7/E6LA+cdoPvHsSirguFOdsSl7/oPpG8AD6EcWeg=@vger.kernel.org X-Gm-Message-State: AOJu0YwiZeFYdENpYe/EuK/df7y8Sp+v2xAzHKnETrIdu49yWbG8r5DB is85gm63JpGv+x2DO5jFnJx55m+wK7BKM8fZEJCDfx1vTf2CaxHe7O+gTTwk6vAz9Q== X-Gm-Gg: ASbGnctMMC6+b06mna8NhXbOy0cdMrUigdv5r1MQUsNPJNCnfRHHaiuHTeuyc+oyJ3S IaM6rSVA1tjstcCxEvbK0ZjuHFSkhPm0RXWlf62dte1eX90ssIAR/HPUL9ZZ8hsNGKtM4GkZrps c94FijOfS3uTCAhOh61S9aDbASusEOkU9QqGT7bH4LojsYRqYo92HnP+lKv3Y4GFhltdApZ3eFF eCMnwld/dVmRCVo10l6A4UQq278MtmRSopnPmIliSj4yxIbbGVyD5NDOvxgNLj4O+gMFpDFbMmr gGAKvlpt2OdCumznbGowenn4LNZK49cqOiEqc70LwmId53nDNUVcH1albFADxCK+eo3nmfLTls6 KIxtFWIDZi98op0smrOt4YZ6V2zhToNcJV3BXFziq//biGMtTuwpw1PA8z/7cbrZ/khEfetABEN NjKOkfoa1pzaO3juLu9Ck51lS0ICWJVFRf8XQlorRKBu/gb6Zi9SZ4MR9u85qPHEF/cvyX1OV1b DZj3GAqwSwEnig5p5SZ1/69duyy0is= X-Google-Smtp-Source: AGHT+IENm05lp2n5p9aaZwPR6AbyHzdYiijOCfRa1baT1RHuX94T4U1gtpighni0ZWGkTrpfmPN3Aw== X-Received: by 2002:a05:7300:bc86:b0:2a4:3594:72d4 with SMTP id 5a478bee46e88-2a4ab88e643mr1939285eec.3.1763164491131; Fri, 14 Nov 2025 15:54:51 -0800 (PST) Received: from khazhy-linux.svl.corp.google.com ([2a00:79e0:2e5b:9:bb76:6725:868a:78e5]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2a49db7a753sm14114818eec.6.2025.11.14.15.54.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Nov 2025 15:54:50 -0800 (PST) From: Khazhismel Kumykov X-Google-Original-From: Khazhismel Kumykov To: Tejun Heo , Josef Bacik , Jens Axboe Cc: cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck , Yu Kuai , Khazhismel Kumykov Subject: [PATCH v2 3/3] block/blk-throttle: Remove throtl_slice from struct throtl_data Date: Fri, 14 Nov 2025 15:54:34 -0800 Message-ID: <20251114235434.2168072-4-khazhy@google.com> X-Mailer: git-send-email 2.52.0.rc1.455.g30608eb744-goog In-Reply-To: <20251114235434.2168072-1-khazhy@google.com> References: <20251114235434.2168072-1-khazhy@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Guenter Roeck throtl_slice is now a constant. Remove the variable and use the constant directly where needed. Cc: Yu Kuai Cc: Tejun Heo Signed-off-by: Guenter Roeck Signed-off-by: Khazhismel Kumykov Reviewed-by: Yu Kuai --- block/blk-throttle.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/block/blk-throttle.c b/block/blk-throttle.c index 041bcf7b2c7c..97188a795848 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c @@ -38,8 +38,6 @@ struct throtl_data /* Total Number of queued bios on READ and WRITE lists */ unsigned int nr_queued[2]; =20 - unsigned int throtl_slice; - /* Work for dispatching throttled bios */ struct work_struct dispatch_work; }; @@ -446,7 +444,7 @@ static void throtl_dequeue_tg(struct throtl_grp *tg) static void throtl_schedule_pending_timer(struct throtl_service_queue *sq, unsigned long expires) { - unsigned long max_expire =3D jiffies + 8 * sq_to_td(sq)->throtl_slice; + unsigned long max_expire =3D jiffies + 8 * DFL_THROTL_SLICE; =20 /* * Since we are adjusting the throttle limit dynamically, the sleep @@ -514,7 +512,7 @@ static inline void throtl_start_new_slice_with_credit(s= truct throtl_grp *tg, if (time_after(start, tg->slice_start[rw])) tg->slice_start[rw] =3D start; =20 - tg->slice_end[rw] =3D jiffies + tg->td->throtl_slice; + tg->slice_end[rw] =3D jiffies + DFL_THROTL_SLICE; throtl_log(&tg->service_queue, "[%c] new slice with credit start=3D%lu end=3D%lu jiffies=3D%lu", rw =3D=3D READ ? 'R' : 'W', tg->slice_start[rw], @@ -529,7 +527,7 @@ static inline void throtl_start_new_slice(struct throtl= _grp *tg, bool rw, tg->io_disp[rw] =3D 0; } tg->slice_start[rw] =3D jiffies; - tg->slice_end[rw] =3D jiffies + tg->td->throtl_slice; + tg->slice_end[rw] =3D jiffies + DFL_THROTL_SLICE; =20 throtl_log(&tg->service_queue, "[%c] new slice start=3D%lu end=3D%lu jiffies=3D%lu", @@ -540,7 +538,7 @@ static inline void throtl_start_new_slice(struct throtl= _grp *tg, bool rw, static inline void throtl_set_slice_end(struct throtl_grp *tg, bool rw, unsigned long jiffy_end) { - tg->slice_end[rw] =3D roundup(jiffy_end, tg->td->throtl_slice); + tg->slice_end[rw] =3D roundup(jiffy_end, DFL_THROTL_SLICE); } =20 static inline void throtl_extend_slice(struct throtl_grp *tg, bool rw, @@ -671,12 +669,12 @@ static inline void throtl_trim_slice(struct throtl_gr= p *tg, bool rw) * sooner, then we need to reduce slice_end. A high bogus slice_end * is bad because it does not allow new slice to start. */ - throtl_set_slice_end(tg, rw, jiffies + tg->td->throtl_slice); + throtl_set_slice_end(tg, rw, jiffies + DFL_THROTL_SLICE); =20 time_elapsed =3D rounddown(jiffies - tg->slice_start[rw], - tg->td->throtl_slice); + DFL_THROTL_SLICE); /* Don't trim slice until at least 2 slices are used */ - if (time_elapsed < tg->td->throtl_slice * 2) + if (time_elapsed < DFL_THROTL_SLICE * 2) return; =20 /* @@ -687,7 +685,7 @@ static inline void throtl_trim_slice(struct throtl_grp = *tg, bool rw) * lower rate than expected. Therefore, other than the above rounddown, * one extra slice is preserved for deviation. */ - time_elapsed -=3D tg->td->throtl_slice; + time_elapsed -=3D DFL_THROTL_SLICE; bytes_trim =3D throtl_trim_bps(tg, rw, time_elapsed); io_trim =3D throtl_trim_iops(tg, rw, time_elapsed); if (!bytes_trim && !io_trim) @@ -697,7 +695,7 @@ static inline void throtl_trim_slice(struct throtl_grp = *tg, bool rw) =20 throtl_log(&tg->service_queue, "[%c] trim slice nr=3D%lu bytes=3D%lld io=3D%d start=3D%lu end=3D%lu = jiffies=3D%lu", - rw =3D=3D READ ? 'R' : 'W', time_elapsed / tg->td->throtl_slice, + rw =3D=3D READ ? 'R' : 'W', time_elapsed / DFL_THROTL_SLICE, bytes_trim, io_trim, tg->slice_start[rw], tg->slice_end[rw], jiffies); } @@ -768,7 +766,7 @@ static unsigned long tg_within_iops_limit(struct throtl= _grp *tg, struct bio *bio jiffy_elapsed =3D jiffies - tg->slice_start[rw]; =20 /* Round up to the next throttle slice, wait time must be nonzero */ - jiffy_elapsed_rnd =3D roundup(jiffy_elapsed + 1, tg->td->throtl_slice); + jiffy_elapsed_rnd =3D roundup(jiffy_elapsed + 1, DFL_THROTL_SLICE); io_allowed =3D calculate_io_allowed(iops_limit, jiffy_elapsed_rnd); if (io_allowed > 0 && tg->io_disp[rw] + 1 <=3D io_allowed) return 0; @@ -794,9 +792,9 @@ static unsigned long tg_within_bps_limit(struct throtl_= grp *tg, struct bio *bio, =20 /* Slice has just started. Consider one slice interval */ if (!jiffy_elapsed) - jiffy_elapsed_rnd =3D tg->td->throtl_slice; + jiffy_elapsed_rnd =3D DFL_THROTL_SLICE; =20 - jiffy_elapsed_rnd =3D roundup(jiffy_elapsed_rnd, tg->td->throtl_slice); + jiffy_elapsed_rnd =3D roundup(jiffy_elapsed_rnd, DFL_THROTL_SLICE); bytes_allowed =3D calculate_bytes_allowed(bps_limit, jiffy_elapsed_rnd); /* Need to consider the case of bytes_allowed overflow. */ if ((bytes_allowed > 0 && tg->bytes_disp[rw] + bio_size <=3D bytes_allowe= d) @@ -848,7 +846,7 @@ static void tg_update_slice(struct throtl_grp *tg, bool= rw) sq_queued(&tg->service_queue, rw) =3D=3D 0) throtl_start_new_slice(tg, rw, true); else - throtl_extend_slice(tg, rw, jiffies + tg->td->throtl_slice); + throtl_extend_slice(tg, rw, jiffies + DFL_THROTL_SLICE); } =20 static unsigned long tg_dispatch_bps_time(struct throtl_grp *tg, struct bi= o *bio) @@ -1333,12 +1331,8 @@ static int blk_throtl_init(struct gendisk *disk) if (ret) { q->td =3D NULL; kfree(td); - goto out; } =20 - td->throtl_slice =3D DFL_THROTL_SLICE; - -out: blk_mq_unquiesce_queue(disk->queue); blk_mq_unfreeze_queue(disk->queue, memflags); =20 --=20 2.52.0.rc1.455.g30608eb744-goog