From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [91.218.175.188]) (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 1FF453BD64A for ; Mon, 20 Jul 2026 09:37:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784540277; cv=none; b=njGoKWHG506A6KRJdugPQ8CopGY8Ej/qw/Ujyk10zYhNKRaSAf2xw+87Ch7BVSlMV23ehUUMnrnP9C3K5Hj3KmJX9rzHNb/zgSH4hmkew17psS+o0pgLF8SF5c51gfSy1EW2DAu2vXSGkMrTNbGjV95DDm1tQwOVsJStGML5TLE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784540277; c=relaxed/simple; bh=SLoaC+4K/Aj0nLpdx60Po9LvLU4QZwA8uDgtvsM4m94=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UaPRnlQqsqpSykthyiW2g0PdkixBYOk1d5efPKO4Fw0ExiV53Eg26zN7QqISmnl6sMtogjeEXA5P0R1lLn8P8VZqSyuo8G9hFUCmpH2xUdWuOME7b/mL/C6ZZ9blcRdpKtkiBLcu8HwRmY3sFPyhPDiG4x2kk11YhEibGhDaIRw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=ZmH+rWf5; arc=none smtp.client-ip=91.218.175.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="ZmH+rWf5" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1784540273; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t10s5HeuWcsqSvUkdc4XvpT/zR0qAKN1Grpg4N+I0L4=; b=ZmH+rWf5ydqM9qKt5JqfN0DLMMnvdABO0vEbGn1FVRFLkGNTE7ZFGSsnGPGAXofijvZIRx jzXtkVxRM22BA2yp0s89ffOvmAyyuVTJXco6pC4nT9C4PXmDyzYqMxFRIvv7e1PQ7tQwh9 t133sYgURD3M+9bxFxlf5Tu+0HhSUkc= From: Tao Cui To: Jens Axboe Cc: Tejun Heo , Josef Bacik , Omar Sandoval , Bart Van Assche , Yu Kuai , Chaitanya Kulkarni , Hannes Reinecke , Ming Lei , Damien Le Moal , Nilay Shroff , linux-block@vger.kernel.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, cui.tao@linux.dev, cuitao@kylinos.cn Subject: [PATCH 2/4] block/blk-iolatency: account per-cpu latency stats over possible CPUs Date: Mon, 20 Jul 2026 17:37:24 +0800 Message-ID: <20260720093726.28965-3-cui.tao@linux.dev> In-Reply-To: <20260720093726.28965-1-cui.tao@linux.dev> References: <20260720093726.28965-1-cui.tao@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT From: Tao Cui iolatency_check_latencies() and iolatency_ssd_stat() iterate a blkg's per-cpu latency stats with for_each_online_cpu(). When a CPU that has accumulated io.latency samples goes offline, its bucket is skipped: the check loop (which also resets) neither sums nor clears it, and the show path under-reports. On re-online the stranded samples are flushed into a later check window, which can trigger a spurious throttle/scale adjustment. Fixes: d70675121546 ("block: introduce blk-iolatency io controller") Fixes: 1fa2840e56f9 ("blk-iolatency: use a percentile approache for ssd's") Signed-off-by: Tao Cui --- block/blk-iolatency.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c index 1cc33aa0b669..d6c401d6174c 100644 --- a/block/blk-iolatency.c +++ b/block/blk-iolatency.c @@ -523,7 +523,7 @@ static void iolatency_check_latencies(struct iolatency_grp *iolat, u64 now) latency_stat_init(iolat, &stat); preempt_disable(); - for_each_online_cpu(cpu) { + for_each_possible_cpu(cpu) { struct latency_stat *s; s = per_cpu_ptr(iolat->stats, cpu); latency_stat_sum(iolat, &stat, s); @@ -924,7 +924,7 @@ static void iolatency_ssd_stat(struct iolatency_grp *iolat, struct seq_file *s) latency_stat_init(iolat, &stat); preempt_disable(); - for_each_online_cpu(cpu) { + for_each_possible_cpu(cpu) { struct latency_stat *s; s = per_cpu_ptr(iolat->stats, cpu); latency_stat_sum(iolat, &stat, s); -- 2.43.0