diff options
| author | Gangadhar Mylapuram <Gangadhar.M@Sun.COM> | 2009-06-26 00:59:33 -0700 |
|---|---|---|
| committer | Gangadhar Mylapuram <Gangadhar.M@Sun.COM> | 2009-06-26 00:59:33 -0700 |
| commit | 552507c5a7c90e17b306850df2f9c79388fff8f8 (patch) | |
| tree | c9a0b24177b20865195e91c97073c95746315ccd /usr/src/uts/common/vm | |
| parent | 4b3dc1e28d71ec83965913203b49cb68c2a9a4a6 (diff) | |
| download | illumos-joyent-552507c5a7c90e17b306850df2f9c79388fff8f8.tar.gz | |
6848845 pages_locked value is leaking
6816657 Use of SHM_LOCK can leak free pages
Diffstat (limited to 'usr/src/uts/common/vm')
| -rw-r--r-- | usr/src/uts/common/vm/seg_spt.c | 11 | ||||
| -rw-r--r-- | usr/src/uts/common/vm/vm_page.c | 3 |
2 files changed, 11 insertions, 3 deletions
diff --git a/usr/src/uts/common/vm/seg_spt.c b/usr/src/uts/common/vm/seg_spt.c index ff8f3749ef..99ff54dc2c 100644 --- a/usr/src/uts/common/vm/seg_spt.c +++ b/usr/src/uts/common/vm/seg_spt.c @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/param.h> #include <sys/user.h> #include <sys/mman.h> @@ -740,6 +738,13 @@ segspt_free_pages(struct seg *seg, caddr_t addr, size_t len) panic("segspt_free_pages: bad large page"); /*NOTREACHED*/ } + /* + * Before destroying the pages, we need to take care + * of the rctl locked memory accounting. For that + * we need to calculte the unlocked_bytes. + */ + if (pp->p_lckcnt > 0) + unlocked_bytes += PAGESIZE; /*LINTED: constant in conditional context */ VN_DISPOSE(pp, B_INVAL, 0, kcred); } diff --git a/usr/src/uts/common/vm/vm_page.c b/usr/src/uts/common/vm/vm_page.c index f5a36ae2cf..8c920cca0a 100644 --- a/usr/src/uts/common/vm/vm_page.c +++ b/usr/src/uts/common/vm/vm_page.c @@ -3077,15 +3077,18 @@ page_destroy(page_t *pp, int dontfree) * Acquire the "freemem_lock" for availrmem. * The page_struct_lock need not be acquired for lckcnt * and cowcnt since the page has an "exclusive" lock. + * We are doing a modified version of page_pp_unlock here. */ if ((pp->p_lckcnt != 0) || (pp->p_cowcnt != 0)) { mutex_enter(&freemem_lock); if (pp->p_lckcnt != 0) { availrmem++; + pages_locked--; pp->p_lckcnt = 0; } if (pp->p_cowcnt != 0) { availrmem += pp->p_cowcnt; + pages_locked -= pp->p_cowcnt; pp->p_cowcnt = 0; } mutex_exit(&freemem_lock); |
