From: Yafang Shao <laoar.shao@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org
Subject: Re: [RFC PATCH] mm: Add large folio support for async readahead
Date: Tue, 5 Nov 2024 13:48:08 +0800 [thread overview]
Message-ID: <CALOAHbA=_AOxNUratjaZ1FCQV723wPHaXW6Ox-5h9TCgoA5ZdQ@mail.gmail.com> (raw)
In-Reply-To: <ZymdSFUDdKc0KV5S@casper.infradead.org>
On Tue, Nov 5, 2024 at 12:21 PM Matthew Wilcox <willy@infradead.org> wrote:
>
> On Tue, Nov 05, 2024 at 11:01:01AM +0800, Yafang Shao wrote:
> > Upon further analysis, it appears that the behavior depends on the
> > /sys/block/*/queue/read_ahead_kb setting. On my test server, this
> > parameter is set to 128KB. For the current approach to work without
> > modification, it would need to be 2MB-aligned.
> >
> > However, I believe MADV_HUGEPAGE behavior should not be dependent on
> > the value of read_ahead_kb. It would be more robust if the kernel
> > automatically aligned it to 2MB when MADV_HUGEPAGE is enabled. The
> > following changes ensure compatibility with non-2MB-aligned
> > read_ahead_kb values:
>
> or maybe:
>
> static unsigned long get_next_ra_size(struct file_ra_state *ra,
> unsigned long max)
> {
> unsigned long cur = ra->size;
>
> if (cur < max / 16)
> return 4 * cur;
> if (cur <= max / 2)
> return 2 * cur;
> + if (cur > max)
> + return cur;
> return max;
> }
>
It is better. Thanks for your suggestion.
--
Regards
Yafang
prev parent reply other threads:[~2024-11-05 5:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-04 14:30 Yafang Shao
2024-11-04 17:00 ` Matthew Wilcox
2024-11-05 3:01 ` Yafang Shao
2024-11-05 4:21 ` Matthew Wilcox
2024-11-05 5:48 ` Yafang Shao [this message]
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='CALOAHbA=_AOxNUratjaZ1FCQV723wPHaXW6Ox-5h9TCgoA5ZdQ@mail.gmail.com' \
--to=laoar.shao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.org \
/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