linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Bernd Schubert <bernd.schubert@fastmail.fm>
Cc: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	Miklos Szeredi <miklos@szeredi.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org
Subject: Re: sequential 1MB mmap read ends in 1 page sync read-ahead
Date: Fri, 14 Apr 2023 23:02:32 +0100	[thread overview]
Message-ID: <ZDnNeKt1bPWb2PzC@casper.infradead.org> (raw)
In-Reply-To: <c59e54f9-6eae-3c35-bce8-ac03af84b3ed@fastmail.fm>

On Fri, Apr 14, 2023 at 10:47:39PM +0200, Bernd Schubert wrote:
> > Up to bs=512K it works fine, 1M (and for what it matters
> > already 768K) introduce the order=0 issue.
> 
> Hmm, I replaced memcpy with dumb version, that copies byte by byte - problem
> gone. Is it possible that the optimized memcpy causes caused kind of random
> memory access and confuses mm / readahead?
> And somehow your memcpy or system is not doing that?

Oh, that would make sense!  If the memcpy() works high-to-low, then
you'd see exactly the behaviour you're reporting.  Whereas low-to-high
results in the behaviour I'm seeing.

Hm.  I don't know what to do about that.  Maybe a "sufficiently large"
memcpy should call posix_madvise(src, n, POSIX_MADV_WILLNEED)


  reply	other threads:[~2023-04-14 22:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <aae918da-833f-7ec5-ac8a-115d66d80d0e@fastmail.fm>
2023-04-13 21:33 ` Bernd Schubert
2023-04-14  4:07   ` Matthew Wilcox
2023-04-14 15:05     ` Bernd Schubert
2023-04-14 19:52       ` Bernd Schubert
2023-04-14 20:47         ` Bernd Schubert
2023-04-14 22:02           ` Matthew Wilcox [this message]
2023-04-17 15:10             ` Bernd Schubert

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=ZDnNeKt1bPWb2PzC@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=bernd.schubert@fastmail.fm \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=miklos@szeredi.hu \
    /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