ppc64 has issues with multiple pagesizes in the same VMA. We currently
force the hugepages to be mapped for malloc at the next TB address, but
that is only necessary if the address is above the TB boundary. Fix that
up. Tested at run- and compile-time.

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

diff -urpN libhugetlbfs-20060911/hugetlbfs.h 
libhugetlbfs-20060911-dev/hugetlbfs.h
--- libhugetlbfs-20060911/hugetlbfs.h   2006-09-07 14:26:48.000000000 +0000
+++ libhugetlbfs-20060911-dev/hugetlbfs.h       2006-09-19 17:50:45.000000000 
+0000
@@ -22,7 +22,7 @@
 #define HUGETLBFS_MAGIC        0x958458f6
 
 long gethugepagesize(void);
-long hugetlbfs_vaddr_granularity(void);
+long hugetlbfs_vaddr_granularity(unsigned long addr);
 int hugetlbfs_test_path(const char *mount);
 const char *hugetlbfs_find_path(void);
 int hugetlbfs_unlinked_fd(void);
diff -urpN libhugetlbfs-20060911/hugeutils.c 
libhugetlbfs-20060911-dev/hugeutils.c
--- libhugetlbfs-20060911/hugeutils.c   2006-09-07 14:26:48.000000000 +0000
+++ libhugetlbfs-20060911-dev/hugeutils.c       2006-09-19 17:53:20.000000000 
+0000
@@ -118,10 +118,13 @@ long gethugepagesize(void)
        return hpage_size;
 }
 
-long hugetlbfs_vaddr_granularity(void)
+long hugetlbfs_vaddr_granularity(unsigned long addr)
 {
 #if defined(__powerpc64__)
-       return (1L << 40);
+       if (addr < (1L << 40))
+               return (1L << 28);
+       else
+               return (1L << 40);
 #elif defined(__powerpc__)
        return (1L << 28);
 #else

-- 
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
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to