summaryrefslogtreecommitdiff
path: root/usr/src/tools/ctf/cvt/ctfmerge.c
diff options
context:
space:
mode:
authorkchow <none@none>2007-10-28 10:20:15 -0700
committerkchow <none@none>2007-10-28 10:20:15 -0700
commit02bc52be7430b2f7fafe1a2c981bff49ef11d6fa (patch)
tree14721ff92a74ba4be3174a552670ce7850c47633 /usr/src/tools/ctf/cvt/ctfmerge.c
parentf0ed2251df2f0c744e0d198d9b79ae5ed937de7b (diff)
downloadillumos-joyent-02bc52be7430b2f7fafe1a2c981bff49ef11d6fa.tar.gz
6453272 ctfmerge uses the largest pagesize from getpagesizes() which can be bad on systems with giant pages
6543997 divide by 0 panic in page_geti_contig_pages during 1g page testing 6587615 1g pagesize support on AMD family 0x10 processors 6588824 throttling large page coalescing needs to be revisited for gigantic pages 6613824 legacy applications (java) should be prevented from inadvertantly using 1g pagesize --HG-- rename : usr/src/lib/libc/common/sys/getpagesizes.s => deleted_files/usr/src/lib/libc/common/sys/getpagesizes.s
Diffstat (limited to 'usr/src/tools/ctf/cvt/ctfmerge.c')
-rw-r--r--usr/src/tools/ctf/cvt/ctfmerge.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/usr/src/tools/ctf/cvt/ctfmerge.c b/usr/src/tools/ctf/cvt/ctfmerge.c
index 70ca22c7fe..2def4904a6 100644
--- a/usr/src/tools/ctf/cvt/ctfmerge.c
+++ b/usr/src/tools/ctf/cvt/ctfmerge.c
@@ -206,6 +206,8 @@ static char *outfile = NULL;
static char *tmpname = NULL;
static int dynsym;
int debug_level = DEBUG_LEVEL;
+static size_t maxpgsize = 0x400000;
+
void
usage(void)
@@ -228,7 +230,7 @@ static void
bigheap(void)
{
size_t big, *size;
- int sizes, i;
+ int sizes;
struct memcntl_mha mha;
/*
@@ -237,12 +239,16 @@ bigheap(void)
if ((sizes = getpagesizes(NULL, 0)) == -1)
return;
- if ((size = alloca(sizeof (size_t) * sizes)) == NULL)
+ if (sizes == 1 || (size = alloca(sizeof (size_t) * sizes)) == NULL)
return;
- if (getpagesizes(size, sizes) == -1 || sizes == 1)
+ if (getpagesizes(size, sizes) == -1)
return;
+ while (size[sizes - 1] > maxpgsize)
+ sizes--;
+
+ /* set big to the largest allowed page size */
big = size[sizes - 1];
if (big & (big - 1)) {
/*
@@ -259,21 +265,13 @@ bigheap(void)
return;
/*
- * Finally, set our heap to use the largest page size for which the
- * MC_HAT_ADVISE doesn't return EAGAIN.
+ * set the preferred page size for the heap
*/
mha.mha_cmd = MHA_MAPSIZE_BSSBRK;
mha.mha_flags = 0;
+ mha.mha_pagesize = big;
- for (i = sizes - 1; i >= 0; i--) {
- mha.mha_pagesize = size[i];
-
- if (memcntl(NULL, 0, MC_HAT_ADVISE, (caddr_t)&mha, 0, 0) != -1)
- break;
-
- if (errno != EAGAIN)
- break;
- }
+ (void) memcntl(NULL, 0, MC_HAT_ADVISE, (caddr_t)&mha, 0, 0);
}
static void