Lines Matching defs:cache

48  * data.  If the cached data is young enough, the cache is copied, otherwise,
49 * a new calculation is executed and the cache is replaced with the new
251 hrtime_t vmc_timestamp; /* when cache was created */
405 * of visited vnodes and shared amps. Initialize results cache.
1700 * allocate a new cache for N results satisfying flags
1705 vmu_cache_t *cache;
1707 cache = kmem_zalloc(sizeof (vmu_cache_t), KM_SLEEP);
1708 cache->vmc_results = kmem_zalloc(sizeof (vmusage_t) * nres, KM_SLEEP);
1709 cache->vmc_nresults = nres;
1710 cache->vmc_flags = flags;
1711 cache->vmc_refcnt = 1;
1712 return (cache);
1719 vmu_cache_hold(vmu_cache_t *cache)
1722 cache->vmc_refcnt++;
1726 * free cache data
1729 vmu_cache_rele(vmu_cache_t *cache)
1732 ASSERT(cache->vmc_refcnt > 0);
1733 cache->vmc_refcnt--;
1734 if (cache->vmc_refcnt == 0) {
1735 kmem_free(cache->vmc_results, sizeof (vmusage_t) *
1736 cache->vmc_nresults);
1737 kmem_free(cache, sizeof (vmu_cache_t));
1746 vmu_copyout_results(vmu_cache_t *cache, vmusage_t *buf, size_t *nres,
1780 for (result = cache->vmc_results, i = 0;
1781 i < cache->vmc_nresults; result++, i++) {
1943 vmu_cache_t *cache;
1951 cache = vmu_data.vmu_cache;
1952 vmu_cache_hold(cache);
1955 ret = vmu_copyout_results(cache, buf, nres, flags_orig,
1958 vmu_cache_rele(cache);
1965 * If the cache is recent, it is likely that there are other
1974 vmu_cache_t *cache;
1988 /* copy results to cache */
1991 cache = vmu_data.vmu_cache =
1995 result = cache->vmc_results;
2001 cache->vmc_timestamp = gethrtime();
2002 vmu_cache_hold(cache);
2012 /* copy cache */
2013 ret = vmu_copyout_results(cache, buf, nres, flags_orig, cpflg);
2015 vmu_cache_rele(cache);