From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EB7042BEB0; Sat, 12 Sep 2026 10:40:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789209645; cv=none; b=o7wGElQnkI6N7SEeaItGdoV09xW7fVhbxtyKtBL5HFEr82YEAwdo4AdTW903LKhnpg1snnp3QaYL/G7tyU2vV1F3xguH+VEk0X+oVEF/JKoMr3sW08DspVAU+WEDncnOF+59a5X2lMmf+HxZQgIA3563Wu6JsVjZxBFh0lrU9ls= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789209645; c=relaxed/simple; bh=4EWiJzp0+s8oi+bSjhPrHUpnunrZZN6Oge31OF4CRxo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=htr/OD/33MwYui2c/ng7RrPlVXB7k7aXYQYV+Ei2LTNgvfY9gXz19d2AsXAPCEIV0FT1fWHnN/fMNTf/LX0wl7qZv1xi1tuvvP3PaQKVKvMsKsBBXzg+2292hDxMrbOun3Il497y1oyAHR9zBKXT4ukIcW/Z7Dl9DqHZ0NmVwYc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=UneDHRAD; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="UneDHRAD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6A451F000FF; Sat, 12 Sep 2026 10:40:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789209643; bh=sJdi0tNfg9R4OD3LVLGGJuwrRV2YOhP6AozbRFgPocc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=UneDHRAD81fFRChwfZs3pQVfCL0iMo8QVm4pCUqoJvwlyXiUpv6Jb1nAi+jzvt6mN j+H98fSt/rqmZral79NbZJUVAufHD4MzEBqyfJLiSiRq/pKAk8fz6caxV4+T4lxZcD F+5bqXYHQWRwiGx+XrUP+CY1GfNvMeGWCmcyzkVA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tao Cui , Yu Kuai , Jens Axboe , Sasha Levin Subject: [PATCH 6.18 0862/1518] block/blk-stat: drain per-cpu callback stats over possible CPUs Date: Sat, 12 Sep 2026 08:50:31 +0200 Message-ID: <20260912065642.949503960@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065623.398859879@linuxfoundation.org> References: <20260912065623.398859879@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tao Cui [ Upstream commit 9d617828cfc4d9a4d385daa2cd61f9db0592c53f ] blk_stat_timer_fn() sums and resets a callback's per-cpu buckets using for_each_online_cpu(). A CPU that goes offline with pending samples is skipped, so its samples are neither accumulated into the window nor cleared; they sit in the bucket until the CPU comes back online, at which point the stale values are flushed into whatever window is then running. This silently corrupts the latency picture that consumers (notably writeback throttling via wbt, and blk-mq latency tracking) base decisions on around CPU hotplug: under-counting while the CPU is offline, then a burst of stale data on re-online. Fixes: 34dbad5d26e2 ("blk-stat: convert to callback-based statistics reporting") Signed-off-by: Tao Cui Reviewed-by: Yu Kuai Link: https://patch.msgid.link/20260720093726.28965-2-cui.tao@linux.dev Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- block/blk-stat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-stat.c b/block/blk-stat.c index 682a8ddb11734..5c5289b085504 100644 --- a/block/blk-stat.c +++ b/block/blk-stat.c @@ -83,7 +83,7 @@ static void blk_stat_timer_fn(struct timer_list *t) for (bucket = 0; bucket < cb->buckets; bucket++) blk_rq_stat_init(&cb->stat[bucket]); - for_each_online_cpu(cpu) { + for_each_possible_cpu(cpu) { struct blk_rq_stat *cpu_stat; cpu_stat = per_cpu_ptr(cb->cpu_stat, cpu); -- 2.53.0