linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [bug report] read-ahead can't work properly
@ 2019-06-24 13:30 Weijie Yang
  0 siblings, 0 replies; only message in thread
From: Weijie Yang @ 2019-06-24 13:30 UTC (permalink / raw)
  To: linux-kernel, linux-mm; +Cc: axboe, fengguang.wu, linux-api, weijie.yang


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. 

Thanks 





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-06-24 13:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-24 13:30 [bug report] read-ahead can't work properly Weijie Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox