Re: Questions about folio allocation.

From: Matthew Wilcox
Date: Wed Apr 27 2022 - 17:15:36 EST


On Sun, Apr 24, 2022 at 09:30:26PM +0800, Guo Xuenan wrote:
> Hmm.. sorry my expression is not rigorous enough, but i think you have got
> it partly.
> Read the whole file but not only 100k * 4, in most case page order is 2,
> which means
> that in this way of reading,the order of folio with readahead flag is 0 in
> most case.
>
> [root@localhost ]# echo 4096 > /sys/block/vdb/queue/read_ahead_kb
> [root@localhost ]# echo 4096 > /sys/block/vdb/queue/max_sectors_kb
> [root@localhost ]# bpftrace bpf.bt  > 100K
> [root@localhost ]# cat 100K | awk '{print $11}' | sort | uniq -c
>     884 0
>    55945 2
>      1 3
>      14 4
>      2 5
>      5 6
>
> According to the readahead code, the inital order is from current folio with
> readahead flag,
> may the inital order based on size of readadhead window is better?
> (eg: ra->size big enough and considering index alignment then set the
> order?)

Try this patch; it should fix the problem you're seeing. At least, it
does in my tests.