linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Weijie Yang" <weijieut@163.com>
To: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Cc: axboe@fb.com, fengguang.wu@intel.com, linux-api@vger.kernel.org,
	 "weijie.yang@samsung.com" <weijie.yang@samsung.com>
Subject: [bug report] read-ahead can't work properly
Date: Mon, 24 Jun 2019 21:30:10 +0800 (CST)	[thread overview]
Message-ID: <37a8bb5a.af8b.16b89adff5d.Coremail.weijieut@163.com> (raw)


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 





                 reply	other threads:[~2019-06-24 13:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=37a8bb5a.af8b.16b89adff5d.Coremail.weijieut@163.com \
    --to=weijieut@163.com \
    --cc=axboe@fb.com \
    --cc=fengguang.wu@intel.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=weijie.yang@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox