morecore: mlock() failure is non-fatal

Kernels before 2.6.17 did not properly support mlock() on hugepages (for
instance, the SLES10 kernel). But we currently fail out of the morecore
code, if mlock fails (since 1.1). This error may not be fatal -- and if
it is (that is, we're racing with another process for bringing hugepages
in), then we're going to fail anyways.

Signed-off-by: Nishanth Aravamudan <[EMAIL PROTECTED]>

diff --git a/morecore.c b/morecore.c
index fca4ff0..95169c1 100644
--- a/morecore.c
+++ b/morecore.c
@@ -112,10 +112,9 @@ static void *hugetlbfs_morecore(ptrdiff_t increment)
                        WARNING("Failed to reserve huge pages in "
                                        "hugetlbfs_morecore(): %s\n",
                                        strerror(errno));
-                       munmap(p, newsize);
-                       return NULL;
+               } else {
+                       munlock(p, newsize);
                }
-               munlock(p, newsize);
 
                /* we now have mmap'd further */
                mapsize += newsize;
-- 
Nishanth Aravamudan <[EMAIL PROTECTED]>
IBM Linux Technology Center

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Libhugetlbfs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to