Mercurial > illumos > illumos-gate
changeset 3307:08dd9db5d94e
6506748 segzio uses unfeasibly large amount of VA
author | johansen |
---|---|
date | Thu, 21 Dec 2006 02:22:02 -0800 |
parents | e6d3a5184d69 |
children | 78c915eacfcd |
files | usr/src/uts/common/fs/zfs/arc.c usr/src/uts/i86pc/os/startup.c usr/src/uts/sun4/os/startup.c |
diffstat | 3 files changed, 26 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/common/fs/zfs/arc.c Wed Dec 20 22:32:03 2006 -0800 +++ b/usr/src/uts/common/fs/zfs/arc.c Thu Dec 21 02:22:02 2006 -0800 @@ -1297,6 +1297,18 @@ if (availrmem < swapfs_minfree + swapfs_reserve + extra) return (1); + /* + * If zio data pages are being allocated out of a separate heap segment, + * then check that the size of available vmem for this area remains + * above 1/4th free. This needs to be done since the size of the + * non-default segment is smaller than physical memory, so we could + * conceivably run out of VA in that segment before running out of + * physical memory. + */ + if ((zio_arena != NULL) && (btop(vmem_size(zio_arena, VMEM_FREE)) < + (btop(vmem_size(zio_arena, VMEM_FREE | VMEM_ALLOC)) >> 2))) + return (1); + #if defined(__i386) /* * If we're on an i386 platform, it's possible that we'll exhaust the
--- a/usr/src/uts/i86pc/os/startup.c Wed Dec 20 22:32:03 2006 -0800 +++ b/usr/src/uts/i86pc/os/startup.c Thu Dec 21 02:22:02 2006 -0800 @@ -1585,18 +1585,22 @@ if (!segzio_fromheap) { size_t size; + size_t maxsize; /* size is in bytes, segziosize is in pages */ if (segziosize == 0) { - size = mmu_ptob(physmem * 2); + size = mmu_ptob(physmem / 2); } else { size = mmu_ptob(segziosize); } + /* max size is 3/4ths of physmem */ + maxsize = mmu_ptob(physmem) - mmu_ptob(physmem / 4); + if (size < SEGZIOMINSIZE) { size = SEGZIOMINSIZE; - } else if (size > mmu_ptob(physmem * 4)) { - size = mmu_ptob(physmem * 4); + } else if (size > maxsize) { + size = maxsize; } segziosize = mmu_btop(ROUND_UP_LPAGE(size)); segzio_base = final_kernelheap;
--- a/usr/src/uts/sun4/os/startup.c Wed Dec 20 22:32:03 2006 -0800 +++ b/usr/src/uts/sun4/os/startup.c Thu Dec 21 02:22:02 2006 -0800 @@ -2066,18 +2066,22 @@ if (!segzio_fromheap) { size_t size; + size_t maxsize; /* size is in bytes, segziosize is in pages */ if (segziosize == 0) { - size = mmu_ptob(physmem * 2); + size = mmu_ptob(physmem / 2); } else { size = mmu_ptob(segziosize); } + /* maxsize is 3/4th physmem */ + maxsize = mmu_ptob(physmem) - mmu_ptob(physmem / 4); + if (size < SEGZIOMINSIZE) { size = SEGZIOMINSIZE; - } else if (size > mmu_ptob(physmem * 4)) { - size = mmu_ptob(physmem * 4); + } else if (size > maxsize) { + size = maxsize; } segziosize = mmu_btop(roundup(size, MMU_PAGESIZE)); /* put the base of the ZIO segment after the kpm segment */