linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* MAP_POPULATE does not work with XIP on ramdisk
@ 2015-01-06 23:14 Andiry Xu
  0 siblings, 0 replies; only message in thread
From: Andiry Xu @ 2015-01-06 23:14 UTC (permalink / raw)
  To: linux-kernel, Linux MM; +Cc: Andiry Xu

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>

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

only message in thread, other threads:[~2015-01-06 23:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-06 23:14 MAP_POPULATE does not work with XIP on ramdisk Andiry Xu

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