Re: [PATCH v2 0/1] bcache: track active bypass writes to prevent stale cache reads
"Coly Li" <[email protected]> Wed, 17 Jun 2026 18:41:46 +0800
| Newsgroups | org.kernel.vger.linux-bcache,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
> 2026=E5=B9=B46=E6=9C=8817=E6=97=A5 18:33=EF=BC=8CAnkit Kapoor <ankitkap@g= oogle.com> =E5=86=99=E9=81=93=EF=BC=9A >=20 > Hi Coly, >=20 > This is v2 of the patch to fix a race condition between read cache > misses and bypass writes.=20 >=20 > Changes in v2: > Instead of deferring key invalidation, we now explicitly track active > bypass writes using dynamically allocated pages (modeled closely after > md-bitmap.c as suggested by Coly). We use this tracking information > during cache miss reads to determine if the read must also bypass the > cache. >=20 > The active bypass writes are tracked by dividing the backing device > space into 32MB chunks and maintaining concurrent write refcounts. The > memory overhead is minimal; a single 4KB page covers 64 GB of backing > device space in the chosen approach. >=20 > Implementation Approaches Evaluated: > When designing this, we evaluated three synchronization approaches: > 1. Global Spinlock > 2. Page-level Spinlock (Chosen Approach) > 3. Atomic Counters (Lockless) Thanks, patch received. I will response you after reviewed them. Coly Li