From: Bradley Morgan <bradley.morgan@linux.dev>
To: hppiscas@163.com
Cc: bsegall@google.com, colyli@fygo.io, david@kernel.org,
dietmar.eggemann@arm.com, juri.lelli@redhat.com, kees@kernel.org,
kent.overstreet@linux.dev, kprateek.nayak@amd.com,
liam@infradead.org, linux-bcache@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
mgorman@suse.de, mhocko@suse.com, mingo@redhat.com,
peterz@infradead.org, rostedt@goodmis.org, rppt@kernel.org,
vbabka@kernel.org, vincent.guittot@linaro.org,
vschneid@redhat.com
Subject: Re: [PATCH] fork: use IS_ENABLED(CONFIG_BCACHE) when initializing sequential_io
Date: Fri, 04 Dec 2026 07:42:07 +0000 [thread overview]
Message-ID: <1E3AAF9F-466E-46FA-9155-C885BBB81775@linux.dev> (raw)
In-Reply-To: <179635128328.74470.8992894868872270442@163.com>
On 4 December 2026 02:28:03 GMT, Pengpeng Hou <hppiscas@163.com> wrote:
>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")
Reviewed-by: Bradley Morgan <bradley.morgan@linux.dev>
>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
>
>
>
--- Thanks!
prev parent reply other threads:[~2026-12-04 7:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 2:28 [PATCH] fork: use IS_ENABLED(CONFIG_BCACHE) when initializing sequential_io Pengpeng Hou
2026-12-04 2:53 ` Liam R. Howlett
2026-12-04 4:46 ` Coly Li
2026-12-04 7:42 ` Bradley Morgan [this message]
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=1E3AAF9F-466E-46FA-9155-C885BBB81775@linux.dev \
--to=bradley.morgan@linux.dev \
--cc=bsegall@google.com \
--cc=colyli@fygo.io \
--cc=david@kernel.org \
--cc=dietmar.eggemann@arm.com \
--cc=hppiscas@163.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