From: Mel Gorman <[EMAIL PROTECTED]>

Similar to morecore, it is necessary to prefault regions allocated by
get_huge_pagess() when requested.

Signed-off-by: Mel Gorman <[EMAIL PROTECTED]>
---
 alloc.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/alloc.c b/alloc.c
index 596c3c1..197c1ce 100644
--- a/alloc.c
+++ b/alloc.c
@@ -102,6 +102,16 @@ void *get_huge_pages(size_t len, ghp_t flags)
                return NULL;
        }
 
+       /* Fault the region to ensure accesses succeed */
+       if (__lh_hugetlbfs_prefault(heap_fd, buf, len) != 0) {
+               munmap(buf, len);
+               close(heap_fd);
+
+               /* Try falling back to base pages if allowed */
+               if (flags & GHP_FALLBACK)
+                       return fallback_base_pages(len, flags);
+       }
+
        /* Close the file so we do not have to track the descriptor */
        if (close(heap_fd) != 0) {
                WARNING("Failed to close new heap fd: %s\n", strerror(errno));
-- 
1.5.6.3


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to