From: Pengpeng Hou <hppiscas@163.com>
To: Kees Cook <kees@kernel.org>, David Hildenbrand <david@kernel.org>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>
Cc: "Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>, Michal Hocko <mhocko@suse.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
K Prateek Nayak <kprateek.nayak@amd.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Pengpeng Hou <hppiscas@163.com>, Coly Li <colyli@fygo.io>,
Kent Overstreet <kent.overstreet@linux.dev>,
linux-bcache@vger.kernel.org
Subject: [PATCH] fork: use IS_ENABLED(CONFIG_BCACHE) when initializing sequential_io
Date: Fri, 4 Dec 2026 10:28:03 +0800 [thread overview]
Message-ID: <179635128328.74470.8992894868872270442@163.com> (raw)
When bcache is modular, fork copies the parent's sequential I/O counters
but skips the code that resets them for the child. On a miss in the
recent-I/O table, bcache folds the inherited count into the average
before updating the current count. The average is used to decide whether
to bypass the cache.
Reset both counters for modular bcache as well as for built-in bcache.
Leave the bypass algorithm unchanged.
The issue was found by our static-analysis tool and manually reviewed.
Fixes: cafe56359144 ("bcache: A block layer cache")
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
---
The original patch was prepared with Gemini. Codex assisted with this
review and revision (Assisted-by: gpt 5).
Built fork.o on x86-64 with GCC 11.4 and W=1 (CONFIG_BCACHE=m). No
runtime or hardware test was performed.
kernel/fork.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/fork.c b/kernel/fork.c
index d55a7d21a8fb23b908466b0024aab3f917a6eb7b..cefb6e97b83a4bd9b2f5c94c46e31b5b57d5cebc 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -2285,7 +2285,7 @@ __latent_entropy struct task_struct *copy_process(
p->blocked_on = NULL; /* not blocked yet */
p->blocked_donor = NULL; /* nobody is boosting p yet */
-#ifdef CONFIG_BCACHE
+#if IS_ENABLED(CONFIG_BCACHE)
p->sequential_io = 0;
p->sequential_io_avg = 0;
#endif
base-commit: d06ce6f1eb5eeffd4ebcfde345dc34a98131d106
next reply other threads:[~2026-12-04 2:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 2:28 Pengpeng Hou [this message]
2026-12-04 2:53 ` Liam R. Howlett
2026-12-04 4:46 ` Coly Li
2026-12-04 7:42 ` Bradley Morgan
2026-12-04 15:02 ` Steven Rostedt
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=179635128328.74470.8992894868872270442@163.com \
--to=hppiscas@163.com \
--cc=bsegall@google.com \
--cc=colyli@fygo.io \
--cc=david@kernel.org \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kees@kernel.org \
--cc=kent.overstreet@linux.dev \
--cc=kprateek.nayak@amd.com \
--cc=liam@infradead.org \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@suse.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=rppt@kernel.org \
--cc=vbabka@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.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
all inboxes | Powered by JetHome®