aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDean Luick <luick@cray.com>2008-04-14 15:06:44 -0500
committerNishanth Aravamudan <nacc@us.ibm.com>2008-04-15 09:27:14 -0700
commit0991ce9c0657f24899da64bc2d4df2736c565b7a (patch)
tree1272fe0db1a7b60008840cd90da9bea8bd9c4cd7
parentd641b32a3341bb62a0e6bd2b7fbb34962ca22bf7 (diff)
downloadlibhugetlbfs-0991ce9c0657f24899da64bc2d4df2736c565b7a.tar.gz
Friendlier morecore.c warnings
This patch makes the morecore.c WARNING messages more user friendly and informative for those not turning on the debug messages. The most significant of these changes is a print of the number of huge pages requested when a request fails. Signed-off-by: Dean Luick <luick@cray.com> Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
-rw-r--r--morecore.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/morecore.c b/morecore.c
index 11df17d..eb9c1ec 100644
--- a/morecore.c
+++ b/morecore.c
@@ -102,7 +102,8 @@ static void *hugetlbfs_morecore(ptrdiff_t increment)
p = mmap(heapbase + mapsize, delta, PROT_READ|PROT_WRITE,
MAP_PRIVATE, heap_fd, mapsize);
if (p == MAP_FAILED) {
- WARNING("Mapping failed in hugetlbfs_morecore()\n");
+ WARNING("New heap segment map at %p failed: %s\n",
+ heapbase+mapsize, strerror(errno));
return NULL;
}
@@ -119,7 +120,7 @@ static void *hugetlbfs_morecore(ptrdiff_t increment)
} else if (p != (heapbase + mapsize)) {
/* Couldn't get the mapping where we wanted */
munmap(p, delta);
- WARNING("Mapped at %p instead of %p in hugetlbfs_morecore()\n",
+ WARNING("New heap segment mapped at %p instead of %p\n",
p, heapbase + mapsize);
if (__hugetlbfs_debug)
dump_proc_pid_maps();
@@ -152,8 +153,8 @@ static void *hugetlbfs_morecore(ptrdiff_t increment)
if (ret != i) {
DEBUG("Got %d of %d requested; err=%d\n", ret,
i, ret < 0 ? errno : 0);
- WARNING("Failed to reserve huge pages in "
- "hugetlbfs_morecore()\n");
+ WARNING("Failed to reserve %ld huge pages "
+ "for heap\n", delta/blocksize);
munmap(p, delta);
return NULL;
}
@@ -166,7 +167,7 @@ static void *hugetlbfs_morecore(ptrdiff_t increment)
/* shrinking the heap */
if (!mapsize) {
- WARNING("Can't shrink empty heap!");
+ WARNING("Can't shrink empty heap!\n");
return NULL;
}
@@ -190,7 +191,7 @@ static void *hugetlbfs_morecore(ptrdiff_t increment)
heapbase + mapsize + delta);
ret = munmap(heapbase + mapsize + delta, -delta);
if (ret) {
- WARNING("Unmapping failed in hugetlbfs_morecore(): "
+ WARNING("Unmapping failed while shrinking heap: "
"%s\n", strerror(errno));
} else {
@@ -200,9 +201,8 @@ static void *hugetlbfs_morecore(ptrdiff_t increment)
mapsize += delta;
ret = ftruncate(heap_fd, mapsize);
if (ret) {
- WARNING("Couldn't truncate hugetlbfs file in "
- "hugetlbfs_morecore(): %s\n",
- strerror(errno));
+ WARNING("Could not truncate hugetlbfs file to "
+ "shrink heap: %s\n", strerror(errno));
}
}