Re: [PATCH] mm/readahead: Skip fully overlapped range
From: Aubrey Li
Date: Tue Sep 23 2025 - 01:52:33 EST
On 9/23/25 11:49, Andrew Morton wrote:
> On Tue, 23 Sep 2025 11:59:46 +0800 Aubrey Li <aubrey.li@xxxxxxxxxxxxxxx> wrote:
>
>> RocksDB sequential read benchmark under high concurrency shows severe
>> lock contention. Multiple threads may issue readahead on the same file
>> simultaneously, which leads to heavy contention on the xas spinlock in
>> filemap_add_folio(). Perf profiling indicates 30%~60% of CPU time spent
>> there.
>>
>> To mitigate this issue, a readahead request will be skipped if its
>> range is fully covered by an ongoing readahead. This avoids redundant
>> work and significantly reduces lock contention. In one-second sampling,
>> contention on xas spinlock dropped from 138,314 times to 2,144 times,
>> resulting in a large performance improvement in the benchmark.
>>
>> w/o patch w/ patch
>> RocksDB-readseq (ops/sec)
>> (32-threads) 1.2M 2.4M
>
> On which kernel version? In recent times we've made a few readahead
> changes to address issues with high concurrency and a quick retest on
> mm.git's current mm-stable branch would be interesting please.
>
I'm on v6.16.7. Thanks Andrew for the information, let me check with mm.git.
Thanks,
-Aubrey