Anthony Liguori wrote: > Marcelo Tosatti wrote: >> This is Linux's behaviour for all filesystems. There is no error >> checking on MAP_POPULATE's attempt to prefault pages. >> > > I thought that mmap() will fail with hugetlbfs if enough large pages > can't be reserved? This appears to be the case for MAP_SHARED. For MAP_PRIVATE the accounting is side-stepped, the result of which was the best-effort prealloc/populate behavior we had see seen. Marcelo and I batted this around some yesterday. And there doesn't appear to be any concern using MAP_SHARED for the phys_ram map as potential access to the backing file is still regulated by filesystem permissions. Doing so dispenses with the syscall/useraddr hack to fault in pages since mmap() fails as expected in the case sufficient pages are unavailable immediately to back MAP_SHARED pages. We also decided to defer the map-fallback logic. This is essentially behavior we'd like to see provided by kvm, ideally on a dynamic (guest fault) basis and was technically beyond the issue we were trying to target. Attached is the resulting patch which also addresses the other concerns which arose. -john -- john.cooper@third-harmonic.com