Print this page
9936 atomic ops in syscall_mstate() induce significant overhead
9942 zone secflags are not initialized correctly

*** 1910,1934 **** static int zone_misc_kstat_update(kstat_t *ksp, int rw) { zone_t *zone = ksp->ks_private; zone_misc_kstat_t *zmp = ksp->ks_data; ! hrtime_t tmp; if (rw == KSTAT_WRITE) return (EACCES); ! tmp = zone->zone_utime; ! scalehrtime(&tmp); ! zmp->zm_utime.value.ui64 = tmp; ! tmp = zone->zone_stime; ! scalehrtime(&tmp); ! zmp->zm_stime.value.ui64 = tmp; ! tmp = zone->zone_wtime; ! scalehrtime(&tmp); ! zmp->zm_wtime.value.ui64 = tmp; zmp->zm_avenrun1.value.ui32 = zone->zone_avenrun[0]; zmp->zm_avenrun5.value.ui32 = zone->zone_avenrun[1]; zmp->zm_avenrun15.value.ui32 = zone->zone_avenrun[2]; zmp->zm_ffcap.value.ui32 = zone->zone_ffcap; --- 1910,1940 ---- static int zone_misc_kstat_update(kstat_t *ksp, int rw) { zone_t *zone = ksp->ks_private; zone_misc_kstat_t *zmp = ksp->ks_data; ! hrtime_t hrtime; ! uint64_t tmp; if (rw == KSTAT_WRITE) return (EACCES); ! tmp = cpu_uarray_sum(zone->zone_ustate, ZONE_USTATE_STIME); ! hrtime = UINT64_OVERFLOW_TO_INT64(tmp); ! scalehrtime(&hrtime); ! zmp->zm_stime.value.ui64 = hrtime; + tmp = cpu_uarray_sum(zone->zone_ustate, ZONE_USTATE_UTIME); + hrtime = UINT64_OVERFLOW_TO_INT64(tmp); + scalehrtime(&hrtime); + zmp->zm_utime.value.ui64 = hrtime; + + tmp = cpu_uarray_sum(zone->zone_ustate, ZONE_USTATE_WTIME); + hrtime = UINT64_OVERFLOW_TO_INT64(tmp); + scalehrtime(&hrtime); + zmp->zm_wtime.value.ui64 = hrtime; + zmp->zm_avenrun1.value.ui32 = zone->zone_avenrun[0]; zmp->zm_avenrun5.value.ui32 = zone->zone_avenrun[1]; zmp->zm_avenrun15.value.ui32 = zone->zone_avenrun[2]; zmp->zm_ffcap.value.ui32 = zone->zone_ffcap;
*** 2095,2108 **** zone0.zone_initname = initname; zone0.zone_lockedmem_kstat = NULL; zone0.zone_swapresv_kstat = NULL; zone0.zone_nprocs_kstat = NULL; - zone0.zone_stime = 0; - zone0.zone_utime = 0; - zone0.zone_wtime = 0; - list_create(&zone0.zone_ref_list, sizeof (zone_ref_t), offsetof(zone_ref_t, zref_linkage)); list_create(&zone0.zone_zsd, sizeof (struct zsd_entry), offsetof(struct zsd_entry, zsd_linkage)); list_insert_head(&zone_active, &zone0); --- 2101,2110 ----
*** 2302,2311 **** --- 2304,2315 ---- /* * Initialise the lock for the database structure used by mntfs. */ rw_init(&zone0.zone_mntfs_db_lock, NULL, RW_DEFAULT, NULL); + zone0.zone_ustate = cpu_uarray_zalloc(ZONE_USTATE_MAX, KM_SLEEP); + mutex_enter(&zonehash_lock); zone_uniqid(&zone0); ASSERT(zone0.zone_uniqid == GLOBAL_ZONEUNIQID); zonehashbyid = mod_hash_create_idhash("zone_by_id", zone_hash_size,
*** 2386,2395 **** --- 2390,2401 ---- list_destroy(&zone->zone_ref_list); zone_free_zsd(zone); zone_free_datasets(zone); list_destroy(&zone->zone_dl_list); + cpu_uarray_free(zone->zone_ustate); + if (zone->zone_rootvp != NULL) VN_RELE(zone->zone_rootvp); if (zone->zone_rootpath) kmem_free(zone->zone_rootpath, zone->zone_rootpathlen); if (zone->zone_name != NULL)
*** 3201,3216 **** * second. * * Based on loadavg_update(), genloadavg() and calcloadavg() from clock.c. */ void ! zone_loadavg_update() { zone_t *zp; zone_status_t status; struct loadavg_s *lavg; hrtime_t zone_total; int i; hrtime_t hr_avg; int nrun; static int64_t f[3] = { 135, 27, 9 }; int64_t q, r; --- 3207,3223 ---- * second. * * Based on loadavg_update(), genloadavg() and calcloadavg() from clock.c. */ void ! zone_loadavg_update(void) { zone_t *zp; zone_status_t status; struct loadavg_s *lavg; hrtime_t zone_total; + uint64_t tmp; int i; hrtime_t hr_avg; int nrun; static int64_t f[3] = { 135, 27, 9 }; int64_t q, r;
*** 3231,3241 **** /* * Update the 10 second moving average data in zone_loadavg. */ lavg = &zp->zone_loadavg; ! zone_total = zp->zone_utime + zp->zone_stime + zp->zone_wtime; scalehrtime(&zone_total); /* The zone_total should always be increasing. */ lavg->lg_loads[lavg->lg_cur] = (zone_total > lavg->lg_total) ? zone_total - lavg->lg_total : 0; --- 3238,3250 ---- /* * Update the 10 second moving average data in zone_loadavg. */ lavg = &zp->zone_loadavg; ! tmp = cpu_uarray_sum_all(zp->zone_ustate); ! zone_total = UINT64_OVERFLOW_TO_INT64(tmp); ! scalehrtime(&zone_total); /* The zone_total should always be increasing. */ lavg->lg_loads[lavg->lg_cur] = (zone_total > lavg->lg_total) ? zone_total - lavg->lg_total : 0;
*** 4521,4534 **** zone->zone_ipc.ipcq_semmni = 0; zone->zone_ipc.ipcq_msgmni = 0; zone->zone_bootargs = NULL; zone->zone_fs_allowed = NULL; ! secflags_zero(&zone0.zone_secflags.psf_lower); ! secflags_zero(&zone0.zone_secflags.psf_effective); ! secflags_zero(&zone0.zone_secflags.psf_inherit); ! secflags_fullset(&zone0.zone_secflags.psf_upper); zone->zone_initname = kmem_alloc(strlen(zone_default_initname) + 1, KM_SLEEP); (void) strcpy(zone->zone_initname, zone_default_initname); zone->zone_nlwps = 0; --- 4530,4540 ---- zone->zone_ipc.ipcq_semmni = 0; zone->zone_ipc.ipcq_msgmni = 0; zone->zone_bootargs = NULL; zone->zone_fs_allowed = NULL; ! psecflags_default(&zone->zone_secflags); zone->zone_initname = kmem_alloc(strlen(zone_default_initname) + 1, KM_SLEEP); (void) strcpy(zone->zone_initname, zone_default_initname); zone->zone_nlwps = 0;
*** 4542,4551 **** --- 4548,4559 ---- zone->zone_max_lofi = 0; zone->zone_max_lofi_ctl = UINT64_MAX; zone0.zone_lockedmem_kstat = NULL; zone0.zone_swapresv_kstat = NULL; + zone->zone_ustate = cpu_uarray_zalloc(ZONE_USTATE_MAX, KM_SLEEP); + /* * Zsched initializes the rctls. */ zone->zone_rctls = NULL;