Author: Nishanth Aravamudan <[EMAIL PROTECTED]>
Date: Mon Feb 26 15:17:54 2007 -0800
hugeutils: add address parameter to hugetlbfs_vaddr_granularity
On ppc64, the actual granularity of hugepage requests depends on the
address in question. Specify the three cases (0-4G, 4G-1TB, 1TB+) in the
function. This is useful for the partial_remap code, as it would
(effectively) never run on ppc64 otherwise (would need a 1TB or larger
segment, without relinking).
Signed-off-by: Nishanth Aravamudan <[EMAIL PROTECTED]>
diff --git a/hugetlbfs.h b/hugetlbfs.h
index 966e57c..cc33db1 100644
--- a/hugetlbfs.h
+++ b/hugetlbfs.h
@@ -22,7 +22,7 @@
#define HUGETLBFS_MAGIC 0x958458f6
long gethugepagesize(void);
-long hugetlbfs_vaddr_granularity(void);
+long hugetlbfs_vaddr_granularity(void *addr);
int hugetlbfs_test_path(const char *mount);
const char *hugetlbfs_find_path(void);
int hugetlbfs_unlinked_fd(void);
diff --git a/hugeutils.c b/hugeutils.c
index 9af92b9..5d99e56 100644
--- a/hugeutils.c
+++ b/hugeutils.c
@@ -114,10 +114,15 @@ long gethugepagesize(void)
return hpage_size;
}
-long hugetlbfs_vaddr_granularity(void)
+long hugetlbfs_vaddr_granularity(void *addr)
{
#if defined(__powerpc64__)
- return (1L << 40);
+ if (addr < (void *)(0x40000000UL))
+ return (1L << 28);
+ else if (addr < (void *)(0x10000000000UL))
+ return (1L << 40) - (1L << 32);
+ else
+ return (1L << 40);
#elif defined(__powerpc__)
return (1L << 28);
#else
diff --git a/morecore.c b/morecore.c
index 25c2d27..7efb174 100644
--- a/morecore.c
+++ b/morecore.c
@@ -166,7 +166,7 @@ static void __attribute__((constructor))
setup_morecore(void)
}
} else {
heapaddr = (unsigned long)sbrk(0);
- heapaddr = ALIGN(heapaddr, hugetlbfs_vaddr_granularity());
+ heapaddr = ALIGN(heapaddr, hugetlbfs_vaddr_granularity((void
*)heapaddr));
}
DEBUG("setup_morecore(): heapaddr = 0x%lx\n", heapaddr);
--
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