From: Andiry Xu <andiry@gmail.com>
To: linux-kernel@vger.kernel.org, Linux MM <linux-mm@kvack.org>
Cc: Andiry Xu <andiry.xu@gmail.com>
Subject: MAP_POPULATE does not work with XIP on ramdisk
Date: Tue, 6 Jan 2015 15:14:41 -0800 [thread overview]
Message-ID: <CAOvWMLZkisXOcxwo6AvKnwG_pEybmB27ZHUiUppcHNGM=c_cDg@mail.gmail.com> (raw)
Hi,
I'm testing mmap() performance on a ramdisk. The kernel is 3.19-rc3.
The device driver is brd, and the file system is ext2. Normal mmap()
does not make sense on a ramdisk because it adds additional memory
copy, so XIP is enabled to map the pages directly into application's
address space.
With XIP, MAP_POPULATE flag does not work. i.e. prefault fails.
Basically it fails in vm_normal_page(), where it's supposed to find
the struct page from pfn, but the vma has flag VM_MIXEDMAP and the
method returns NULL.
As I understand, VM_MIXEDMAP means the memory may not contain a struct
page backing, so the code logic is reasonable. However brd driver does
provide struct page for each memory page. If I modify the
__get_user_pages() and let the prefault runs for all the pages,
MAP_POPULATE works as expected.
My question is, is there any elegant way to workaround this? I do want
to make MAP_POPULATE works with XIP. This is because as the device is
memory and access latency is pretty low, page fault as well as the
mode switch play an important part in the software overhead. In my
experiment, MAP_POPULATE provides a 3x improvement on latency when
access a big file for the first time.
Thanks,
Andiry
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
reply other threads:[~2015-01-06 23:14 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='CAOvWMLZkisXOcxwo6AvKnwG_pEybmB27ZHUiUppcHNGM=c_cDg@mail.gmail.com' \
--to=andiry@gmail.com \
--cc=andiry.xu@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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