[lkml]   [2019]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject[bug report] read-ahead can't work properly

When try the file readahead by posix_fadvise(), I find it can't work properly.

For example, posix_fadvise(POSIX_FADV_WILLNEED) a 10MB file, the kernel
actually readahead only 512KB data to the page cache, even if there are enough
free memory in the machine.

When trace to kernel, I find the issue is at force_page_cache_readahead():

max_pages = max_t(unsigned long, bdi->io_pages, ra->ra_pages);
nr_to_read = min(nr_to_read, max_pages);

No mater what input nr_to_read is, it is limited to a very small size, such as 128 pages.

I think the min() limit code is to limit per-disk-io size, not the total nr_to_read.
and trace the git log, this issue is introduced by 6d2be915e589
after that, nr_to_read is limited at small, even if there are enough free memory.
before that, user can readahead a very large file if they have enough memory.

When read the posix_fadvise() man-page, it says readahead data depending on
virtual memory load.
So if there are enough memory, it should read as many data as user expected.

Expect someone can clarify or/and fix it.


 \ /
  Last update: 2019-06-24 15:49    [W:0.024 / U:12.556 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site