From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: shechenglong <shechenglong@xfusion.com>,
Yu Kuai <yukuai@fnnas.com>, Jens Axboe <axboe@kernel.dk>,
Sasha Levin <sashal@kernel.org>,
tj@kernel.org, josef@toxicpanda.com, linux-block@vger.kernel.org,
cgroups@vger.kernel.org
Subject: [PATCH AUTOSEL 6.18-5.10] block,bfq: fix aux stat accumulation destination
Date: Wed, 7 Jan 2026 10:53:09 -0500 [thread overview]
Message-ID: <20260107155329.4063936-7-sashal@kernel.org> (raw)
In-Reply-To: <20260107155329.4063936-1-sashal@kernel.org>
From: shechenglong <shechenglong@xfusion.com>
[ Upstream commit 04bdb1a04d8a2a89df504c1e34250cd3c6e31a1c ]
Route bfqg_stats_add_aux() time accumulation into the destination
stats object instead of the source, aligning with other stat fields.
Reviewed-by: Yu Kuai <yukuai@fnnas.com>
Signed-off-by: shechenglong <shechenglong@xfusion.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
## Analysis of Commit: block,bfq: fix aux stat accumulation destination
### 1. COMMIT MESSAGE ANALYSIS
The commit message clearly indicates this is a bug fix: "fix aux stat
accumulation destination". It describes that `bfqg_stats_add_aux()` was
routing time accumulation into the wrong destination (source instead of
destination). The fix aligns this field with all other stat fields in
the same function.
- Has `Reviewed-by: Yu Kuai` - BFQ subsystem expertise
- Signed off by Jens Axboe (block subsystem maintainer)
### 2. CODE CHANGE ANALYSIS
The change is a single-line fix in `block/bfq-cgroup.c`:
```c
- bfq_stat_add_aux(&from->time, &from->time);
+ bfq_stat_add_aux(&to->time, &from->time);
```
**The Bug:** The function `bfqg_stats_add_aux()` is documented with `/*
@to += @from */` - it should add stats FROM source TO destination. The
buggy line was adding `from->time` to itself (`&from->time,
&from->time`), which is clearly wrong.
**Root Cause:** A simple typo - `from` was used instead of `to` for the
first argument.
**Pattern Evidence:** Looking at surrounding code, every other line
follows the correct pattern:
- `blkg_rwstat_add_aux(&to->merged, &from->merged)`
- `blkg_rwstat_add_aux(&to->service_time, &from->service_time)`
- `bfq_stat_add_aux(&to->avg_queue_size_sum, &from->avg_queue_size_sum)`
- etc.
Only `time` had the incorrect `&from` as the first argument.
### 3. CLASSIFICATION
- **Bug type:** Logic error (typo) causing incorrect stat accumulation
- **Category:** Clear bug fix - not a feature, not a cleanup
- **Subsystem:** BFQ I/O scheduler cgroup support (debug statistics)
### 4. SCOPE AND RISK ASSESSMENT
- **Lines changed:** 1 line, essentially a single character change
(`from` → `to`)
- **Files touched:** 1 file
- **Risk level:** Extremely LOW
- **Code location:** Under `CONFIG_BFQ_CGROUP_DEBUG` - debug statistics
only
This is about as surgical as a fix can get. Even if the fix were somehow
wrong (which it clearly isn't), it only affects debug statistics output,
not actual I/O scheduling behavior.
### 5. USER IMPACT
- **Affected users:** Those using BFQ I/O scheduler with cgroup
debugging enabled
- **Symptom:** The `time` statistic would be lost (not transferred to
parent) when a BFQ cgroup is destroyed, causing inaccurate cumulative
statistics
- **Severity:** Low to moderate - affects accuracy of debug/monitoring
data, not data integrity or system stability
### 6. STABILITY INDICATORS
- Reviewed by Yu Kuai (BFQ expert)
- Accepted by Jens Axboe (block maintainer)
- Trivially correct fix - the pattern is obvious from surrounding code
### 7. DEPENDENCY CHECK
- **Dependencies:** None - this is a self-contained fix
- **Affected code existence:** BFQ cgroup code has existed in stable
trees for years
- **Clean backport:** Should apply cleanly to any kernel with BFQ cgroup
support
### VERDICT
**Pros:**
- Obviously correct fix (typo/copy-paste error)
- Minimal change (1 line)
- Zero regression risk
- Fixes incorrect behavior in statistics accumulation
- Well-reviewed and accepted by maintainers
- No dependencies on other commits
**Cons:**
- Only affects debug code (`CONFIG_BFQ_CGROUP_DEBUG`)
- Low-impact bug (statistics accuracy, not data/system integrity)
This commit meets all stable kernel criteria:
1. ✅ Obviously correct - trivially evident typo fix
2. ✅ Fixes a real bug - stats were accumulated to wrong destination
3. ✅ Small and contained - single line change
4. ✅ No new features - pure bug fix
5. ✅ Should apply cleanly to stable
While the impact is limited to debug statistics users, the fix is so
trivially correct and low-risk that there's no reason not to backport
it. Users relying on BFQ cgroup statistics for monitoring or debugging
would benefit from accurate data.
**YES**
block/bfq-cgroup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
index 9fb9f3533150..6a75fe1c7a5c 100644
--- a/block/bfq-cgroup.c
+++ b/block/bfq-cgroup.c
@@ -380,7 +380,7 @@ static void bfqg_stats_add_aux(struct bfqg_stats *to, struct bfqg_stats *from)
blkg_rwstat_add_aux(&to->merged, &from->merged);
blkg_rwstat_add_aux(&to->service_time, &from->service_time);
blkg_rwstat_add_aux(&to->wait_time, &from->wait_time);
- bfq_stat_add_aux(&from->time, &from->time);
+ bfq_stat_add_aux(&to->time, &from->time);
bfq_stat_add_aux(&to->avg_queue_size_sum, &from->avg_queue_size_sum);
bfq_stat_add_aux(&to->avg_queue_size_samples,
&from->avg_queue_size_samples);
--
2.51.0
next prev parent reply other threads:[~2026-01-07 15:53 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-07 15:53 [PATCH AUTOSEL 6.18-5.15] smb/server: call ksmbd_session_rpc_close() on error path in create_smb2_pipe() Sasha Levin
2026-01-07 15:53 ` [PATCH AUTOSEL 6.18] io_uring: use GFP_NOWAIT for overflow CQEs on legacy rings Sasha Levin
2026-01-07 15:53 ` [PATCH AUTOSEL 6.18-6.6] smb/server: fix refcount leak in smb2_open() Sasha Levin
2026-01-07 15:53 ` [PATCH AUTOSEL 6.18] wifi: mac80211: don't WARN for connections on invalid channels Sasha Levin
2026-01-07 15:53 ` [PATCH AUTOSEL 6.18-5.10] net: usb: sr9700: support devices with virtual driver CD Sasha Levin
2026-01-07 15:53 ` [PATCH AUTOSEL 6.18-5.10] wifi: mac80211: ocb: skip rx_no_sta when interface is not joined Sasha Levin
2026-01-07 15:53 ` Sasha Levin [this message]
2026-01-07 15:53 ` [PATCH AUTOSEL 6.18] platform/x86: dell-lis3lv02d: Add Latitude 5400 Sasha Levin
2026-01-07 15:53 ` [PATCH AUTOSEL 6.18-5.10] wifi: wlcore: ensure skb headroom before skb_push Sasha Levin
2026-01-07 15:53 ` [PATCH AUTOSEL 6.18-6.6] smb/server: fix refcount leak in parse_durable_handle_context() Sasha Levin
2026-01-07 15:53 ` [PATCH AUTOSEL 6.18] wifi: iwlwifi: Implement settime64 as stub for MVM/MLD PTP Sasha Levin
2026-01-07 15:53 ` [PATCH AUTOSEL 6.18-6.1] LoongArch: Set correct protection_map[] for VM_NONE/VM_SHARED Sasha Levin
2026-01-07 15:53 ` [PATCH AUTOSEL 6.18-6.1] LoongArch: Enable exception fixup for specific ADE subcode Sasha Levin
2026-01-07 15:53 ` [PATCH AUTOSEL 6.18-6.12] md: suspend array while updating raid_disks via sysfs Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260107155329.4063936-7-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=axboe@kernel.dk \
--cc=cgroups@vger.kernel.org \
--cc=josef@toxicpanda.com \
--cc=linux-block@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=shechenglong@xfusion.com \
--cc=stable@vger.kernel.org \
--cc=tj@kernel.org \
--cc=yukuai@fnnas.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox