summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/os
diff options
context:
space:
mode:
authoraguzovsk <none@none>2008-05-22 22:23:49 -0700
committeraguzovsk <none@none>2008-05-22 22:23:49 -0700
commita98e9dbfaecb09c4032dc0076786bd835f25eab3 (patch)
tree2fe194d578bd61221d093cd798fcef4757ca76e3 /usr/src/uts/common/os
parent963390b497bb4a7103b44028e033f1dbb5c81964 (diff)
downloadillumos-joyent-a98e9dbfaecb09c4032dc0076786bd835f25eab3.tar.gz
6423097 segvn_pagelock() may perform very poorly
6526804 DR delete_memory_thread, AIO, and segvn deadlock 6557794 segspt_dismpagelock() and segspt_shmadvise(MADV_FREE) may deadlock 6557813 seg_ppurge_seg() shouldn't flush all unrelated ISM/DISM segments 6557891 softlocks/pagelocks of anon pages should not decrement availrmem for memory swapped pages 6559612 multiple softlocks on a DISM segment should decrement availrmem just once 6562291 page_mem_avail() is stuck due to availrmem overaccounting and lack of seg_preap() calls 6596555 locked anonymous pages should not have assigned disk swap slots 6639424 hat_sfmmu.c:hat_pagesync() doesn't handle well HAT_SYNC_STOPON_REF and HAT_SYNC_STOPON_MOD flags 6639425 optimize checkpage() optimizations 6662927 page_llock contention during I/O
Diffstat (limited to 'usr/src/uts/common/os')
-rw-r--r--usr/src/uts/common/os/kstat_fr.c64
-rw-r--r--usr/src/uts/common/os/mem_cage.c5
-rw-r--r--usr/src/uts/common/os/schedctl.c1
-rw-r--r--usr/src/uts/common/os/shm.c12
-rw-r--r--usr/src/uts/common/os/vm_pageout.c9
5 files changed, 49 insertions, 42 deletions
diff --git a/usr/src/uts/common/os/kstat_fr.c b/usr/src/uts/common/os/kstat_fr.c
index c97b1621cb..b7e84aef21 100644
--- a/usr/src/uts/common/os/kstat_fr.c
+++ b/usr/src/uts/common/os/kstat_fr.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
@@ -494,7 +494,7 @@ kstat_init(void)
*/
kstat_chain_id = 0;
ksp = kstat_create("unix", 0, "kstat_headers", "kstat", KSTAT_TYPE_RAW,
- 0, KSTAT_FLAG_VIRTUAL | KSTAT_FLAG_VAR_SIZE);
+ 0, KSTAT_FLAG_VIRTUAL | KSTAT_FLAG_VAR_SIZE);
if (ksp) {
ksp->ks_lock = &kstat_chain_lock;
ksp->ks_update = header_kstat_update;
@@ -505,35 +505,35 @@ kstat_init(void)
}
ksp = kstat_create("unix", 0, "kstat_types", "kstat",
- KSTAT_TYPE_NAMED, KSTAT_NUM_TYPES, 0);
+ KSTAT_TYPE_NAMED, KSTAT_NUM_TYPES, 0);
if (ksp) {
int i;
kstat_named_t *kn = KSTAT_NAMED_PTR(ksp);
for (i = 0; i < KSTAT_NUM_TYPES; i++) {
kstat_named_init(&kn[i], kstat_data_type[i].name,
- KSTAT_DATA_ULONG);
+ KSTAT_DATA_ULONG);
kn[i].value.ul = i;
}
kstat_install(ksp);
}
ksp = kstat_create("unix", 0, "sysinfo", "misc", KSTAT_TYPE_RAW,
- sizeof (sysinfo_t), KSTAT_FLAG_VIRTUAL);
+ sizeof (sysinfo_t), KSTAT_FLAG_VIRTUAL);
if (ksp) {
ksp->ks_data = (void *) &sysinfo;
kstat_install(ksp);
}
ksp = kstat_create("unix", 0, "vminfo", "vm", KSTAT_TYPE_RAW,
- sizeof (vminfo_t), KSTAT_FLAG_VIRTUAL);
+ sizeof (vminfo_t), KSTAT_FLAG_VIRTUAL);
if (ksp) {
ksp->ks_data = (void *) &vminfo;
kstat_install(ksp);
}
ksp = kstat_create("unix", 0, "segmap", "vm", KSTAT_TYPE_NAMED,
- segmapcnt_ndata, KSTAT_FLAG_VIRTUAL);
+ segmapcnt_ndata, KSTAT_FLAG_VIRTUAL);
if (ksp) {
ksp->ks_data = (void *) segmapcnt_ptr;
ksp->ks_update = segmap_kstat_update;
@@ -541,7 +541,7 @@ kstat_init(void)
}
ksp = kstat_create("unix", 0, "biostats", "misc", KSTAT_TYPE_NAMED,
- biostats_ndata, KSTAT_FLAG_VIRTUAL);
+ biostats_ndata, KSTAT_FLAG_VIRTUAL);
if (ksp) {
ksp->ks_data = (void *) biostats_ptr;
kstat_install(ksp);
@@ -549,7 +549,7 @@ kstat_init(void)
#ifdef VAC
ksp = kstat_create("unix", 0, "flushmeter", "hat", KSTAT_TYPE_RAW,
- sizeof (struct flushmeter), KSTAT_FLAG_VIRTUAL);
+ sizeof (struct flushmeter), KSTAT_FLAG_VIRTUAL);
if (ksp) {
ksp->ks_data = (void *) &flush_cnt;
kstat_install(ksp);
@@ -557,15 +557,15 @@ kstat_init(void)
#endif /* VAC */
ksp = kstat_create("unix", 0, "var", "misc", KSTAT_TYPE_RAW,
- sizeof (struct var), KSTAT_FLAG_VIRTUAL);
+ sizeof (struct var), KSTAT_FLAG_VIRTUAL);
if (ksp) {
ksp->ks_data = (void *) &v;
kstat_install(ksp);
}
ksp = kstat_create("unix", 0, "system_misc", "misc", KSTAT_TYPE_NAMED,
- sizeof (system_misc_kstat) / sizeof (kstat_named_t),
- KSTAT_FLAG_VIRTUAL);
+ sizeof (system_misc_kstat) / sizeof (kstat_named_t),
+ KSTAT_FLAG_VIRTUAL);
if (ksp) {
ksp->ks_data = (void *) &system_misc_kstat;
ksp->ks_update = system_misc_kstat_update;
@@ -573,8 +573,8 @@ kstat_init(void)
}
ksp = kstat_create("unix", 0, "system_pages", "pages", KSTAT_TYPE_NAMED,
- sizeof (system_pages_kstat) / sizeof (kstat_named_t),
- KSTAT_FLAG_VIRTUAL);
+ sizeof (system_pages_kstat) / sizeof (kstat_named_t),
+ KSTAT_FLAG_VIRTUAL);
if (ksp) {
ksp->ks_data = (void *) &system_pages_kstat;
ksp->ks_update = system_pages_kstat_update;
@@ -911,9 +911,9 @@ system_pages_kstat_update(kstat_t *ksp, int rw)
* user explicit page locking.
*/
system_pages_kstat.pp_kernel.value.ul = (ulong_t)(physinstalled -
- obp_pages - availrmem - k_anoninfo.ani_mem_resv -
- anon_segkp_pages_locked - segvn_pages_locked -
- pages_locked - pages_claimed - pages_useclaim);
+ obp_pages - availrmem - k_anoninfo.ani_mem_resv -
+ anon_segkp_pages_locked - pages_locked -
+ pages_claimed - pages_useclaim);
return (0);
}
@@ -923,7 +923,7 @@ kstat_create(const char *ks_module, int ks_instance, const char *ks_name,
const char *ks_class, uchar_t ks_type, uint_t ks_ndata, uchar_t ks_flags)
{
return (kstat_create_zone(ks_module, ks_instance, ks_name, ks_class,
- ks_type, ks_ndata, ks_flags, ALL_ZONES));
+ ks_type, ks_ndata, ks_flags, ALL_ZONES));
}
/*
@@ -966,8 +966,8 @@ kstat_create_zone(const char *ks_module, int ks_instance, const char *ks_name,
*/
if (ks_type >= KSTAT_NUM_TYPES) {
cmn_err(CE_WARN, "kstat_create('%s', %d, '%s'): "
- "invalid kstat type %d",
- ks_module, ks_instance, ks_name, ks_type);
+ "invalid kstat type %d",
+ ks_module, ks_instance, ks_name, ks_type);
return (NULL);
}
@@ -978,8 +978,8 @@ kstat_create_zone(const char *ks_module, int ks_instance, const char *ks_name,
if ((ks_flags & KSTAT_FLAG_PERSISTENT) &&
(ks_flags & KSTAT_FLAG_VIRTUAL)) {
cmn_err(CE_WARN, "kstat_create('%s', %d, '%s'): "
- "cannot create persistent virtual kstat",
- ks_module, ks_instance, ks_name);
+ "cannot create persistent virtual kstat",
+ ks_module, ks_instance, ks_name);
return (NULL);
}
@@ -990,8 +990,8 @@ kstat_create_zone(const char *ks_module, int ks_instance, const char *ks_name,
if ((ks_flags & KSTAT_FLAG_VAR_SIZE) &&
!(ks_flags & KSTAT_FLAG_VIRTUAL)) {
cmn_err(CE_WARN, "kstat_create('%s', %d, '%s'): "
- "cannot create variable-size physical kstat",
- ks_module, ks_instance, ks_name);
+ "cannot create variable-size physical kstat",
+ ks_module, ks_instance, ks_name);
return (NULL);
}
@@ -1001,10 +1001,10 @@ kstat_create_zone(const char *ks_module, int ks_instance, const char *ks_name,
if (ks_ndata < kstat_data_type[ks_type].min_ndata ||
ks_ndata > kstat_data_type[ks_type].max_ndata) {
cmn_err(CE_WARN, "kstat_create('%s', %d, '%s'): "
- "ks_ndata=%d out of range [%d, %d]",
- ks_module, ks_instance, ks_name, (int)ks_ndata,
- kstat_data_type[ks_type].min_ndata,
- kstat_data_type[ks_type].max_ndata);
+ "ks_ndata=%d out of range [%d, %d]",
+ ks_module, ks_instance, ks_name, (int)ks_ndata,
+ kstat_data_type[ks_type].min_ndata,
+ kstat_data_type[ks_type].max_ndata);
return (NULL);
}
@@ -1036,8 +1036,8 @@ kstat_create_zone(const char *ks_module, int ks_instance, const char *ks_name,
*/
kstat_rele(ksp);
cmn_err(CE_WARN, "kstat_create('%s', %d, '%s'): "
- "invalid reactivation of dormant kstat",
- ks_module, ks_instance, ks_name);
+ "invalid reactivation of dormant kstat",
+ ks_module, ks_instance, ks_name);
return (NULL);
}
/*
@@ -1056,8 +1056,8 @@ kstat_create_zone(const char *ks_module, int ks_instance, const char *ks_name,
e = kstat_alloc(ks_flags & KSTAT_FLAG_VIRTUAL ? 0 : ks_data_size);
if (e == NULL) {
cmn_err(CE_NOTE, "kstat_create('%s', %d, '%s'): "
- "insufficient kernel memory",
- ks_module, ks_instance, ks_name);
+ "insufficient kernel memory",
+ ks_module, ks_instance, ks_name);
return (NULL);
}
diff --git a/usr/src/uts/common/os/mem_cage.c b/usr/src/uts/common/os/mem_cage.c
index 8ff50400d2..f6f8c285dd 100644
--- a/usr/src/uts/common/os/mem_cage.c
+++ b/usr/src/uts/common/os/mem_cage.c
@@ -1271,6 +1271,11 @@ kcage_create_throttle(pgcnt_t npages, int flags)
}
}
}
+
+ if (NOMEMWAIT() && freemem < minfree) {
+ return (KCT_CRIT);
+ }
+
}
return (KCT_NONCRIT);
}
diff --git a/usr/src/uts/common/os/schedctl.c b/usr/src/uts/common/os/schedctl.c
index 4a5ccc9944..752c2535c4 100644
--- a/usr/src/uts/common/os/schedctl.c
+++ b/usr/src/uts/common/os/schedctl.c
@@ -676,6 +676,7 @@ schedctl_freepage(struct anon_map *amp, caddr_t kaddr)
* we have to free everything rather than letting as_free
* do the work.
*/
+ anonmap_purge(amp);
anon_free(amp->ahp, 0, PAGESIZE);
ANON_LOCK_EXIT(&amp->a_rwlock);
anonmap_free(amp);
diff --git a/usr/src/uts/common/os/shm.c b/usr/src/uts/common/os/shm.c
index 6407f022d9..c6ee57b758 100644
--- a/usr/src/uts/common/os/shm.c
+++ b/usr/src/uts/common/os/shm.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -718,9 +718,8 @@ shmctl(int shmid, int cmd, void *arg)
if (error = shmem_lock(sp, sp->shm_amp)) {
ANON_LOCK_ENTER(&sp->shm_amp->a_rwlock,
RW_WRITER);
- cmn_err(CE_NOTE,
- "shmctl - couldn't lock %ld pages into "
- "memory", sp->shm_amp->size);
+ cmn_err(CE_NOTE, "shmctl - couldn't lock %ld"
+ " pages into memory", sp->shm_amp->size);
ANON_LOCK_EXIT(&sp->shm_amp->a_rwlock);
error = ENOMEM;
sp->shm_lkcnt--;
@@ -1253,13 +1252,14 @@ shm_rm_amp(kshmid_t *sp)
* Free up the anon_map.
*/
lgrp_shm_policy_fini(amp, NULL);
+ ANON_LOCK_ENTER(&amp->a_rwlock, RW_WRITER);
+ anonmap_purge(amp);
if (amp->a_szc != 0) {
- ANON_LOCK_ENTER(&amp->a_rwlock, RW_WRITER);
anon_shmap_free_pages(amp, 0, amp->size);
- ANON_LOCK_EXIT(&amp->a_rwlock);
} else {
anon_free(amp->ahp, 0, amp->size);
}
+ ANON_LOCK_EXIT(&amp->a_rwlock);
anon_unresv_zone(amp->swresv, zone);
anonmap_free(amp);
}
diff --git a/usr/src/uts/common/os/vm_pageout.c b/usr/src/uts/common/os/vm_pageout.c
index 7a2bb48887..2a521fdb5d 100644
--- a/usr/src/uts/common/os/vm_pageout.c
+++ b/usr/src/uts/common/os/vm_pageout.c
@@ -531,7 +531,7 @@ schedpaging(void *arg)
if (freemem < lotsfree + needfree + kmem_reapahead)
kmem_reap();
- if (freemem < lotsfree + needfree + seg_preapahead)
+ if (freemem < lotsfree + needfree)
seg_preap();
if (kcage_on && (kcage_freemem < kcage_desfree || kcage_needfree))
@@ -957,9 +957,10 @@ checkpage(struct page *pp, int whichhand)
*
* NOTE: These optimizations assume that reads are atomic.
*/
-top:
- if ((PP_ISKAS(pp)) || (PP_ISFREE(pp)) ||
- hat_page_checkshare(pp, po_share) || PAGE_LOCKED(pp)) {
+
+ if (PP_ISKAS(pp) || PAGE_LOCKED(pp) || PP_ISFREE(pp) ||
+ pp->p_lckcnt != 0 || pp->p_cowcnt != 0 ||
+ hat_page_checkshare(pp, po_share)) {
return (-1);
}