Print this page
patch segpcache-maxwindow-is-useless
*** 124,134 ****
/*
* The following variables can be tuned via /etc/system.
*/
int segpcache_enabled = 1; /* if 1, shadow lists are cached */
- pgcnt_t segpcache_maxwindow = 0; /* max # of pages that can be cached */
ulong_t segpcache_hashsize_win = 0; /* # of non wired buckets */
ulong_t segpcache_hashsize_wired = 0; /* # of wired buckets */
int segpcache_reap_sec = 1; /* reap check rate in secs */
clock_t segpcache_reap_ticks = 0; /* reap interval in ticks */
int segpcache_pcp_maxage_sec = 1; /* pcp max age in secs */
--- 124,133 ----
*** 147,164 ****
/*
* Keep frequently used variables together in one cache line.
*/
static struct p_ctrl1 {
uint_t p_disabled; /* if not 0, caching temporarily off */
- pgcnt_t p_maxwin; /* max # of pages that can be cached */
size_t p_hashwin_sz; /* # of non wired buckets */
struct seg_phash *p_htabwin; /* hash table for non wired entries */
size_t p_hashwired_sz; /* # of wired buckets */
struct seg_phash_wired *p_htabwired; /* hash table for wired entries */
kmem_cache_t *p_kmcache; /* kmem cache for seg_pcache structs */
#ifdef _LP64
! ulong_t pad[1];
#endif /* _LP64 */
} pctrl1;
static struct p_ctrl2 {
kmutex_t p_mem_mtx; /* protects window counter and p_halinks */
--- 146,162 ----
/*
* Keep frequently used variables together in one cache line.
*/
static struct p_ctrl1 {
uint_t p_disabled; /* if not 0, caching temporarily off */
size_t p_hashwin_sz; /* # of non wired buckets */
struct seg_phash *p_htabwin; /* hash table for non wired entries */
size_t p_hashwired_sz; /* # of wired buckets */
struct seg_phash_wired *p_htabwired; /* hash table for wired entries */
kmem_cache_t *p_kmcache; /* kmem cache for seg_pcache structs */
#ifdef _LP64
! ulong_t pad[2];
#endif /* _LP64 */
} pctrl1;
static struct p_ctrl2 {
kmutex_t p_mem_mtx; /* protects window counter and p_halinks */
*** 179,189 ****
ulong_t pad[3];
#endif /* _LP64 */
} pctrl3;
#define seg_pdisabled pctrl1.p_disabled
- #define seg_pmaxwindow pctrl1.p_maxwin
#define seg_phashsize_win pctrl1.p_hashwin_sz
#define seg_phashtab_win pctrl1.p_htabwin
#define seg_phashsize_wired pctrl1.p_hashwired_sz
#define seg_phashtab_wired pctrl1.p_htabwired
#define seg_pkmcache pctrl1.p_kmcache
--- 177,186 ----
*** 754,767 ****
if (IS_PFLAGS_WIRED(flags)) {
return (SEGP_SUCCESS);
}
- if (seg_plocked_window + btop(len) > seg_pmaxwindow) {
- return (SEGP_FAIL);
- }
-
if (freemem < desfree) {
return (SEGP_FAIL);
}
return (SEGP_SUCCESS);
--- 751,760 ----
*** 827,840 ****
ASSERT((len & PAGEOFFSET) == 0);
npages = btop(len);
mutex_enter(&seg_pmem_mtx);
if (!IS_PFLAGS_WIRED(flags)) {
- if (seg_plocked_window + npages > seg_pmaxwindow) {
- mutex_exit(&seg_pmem_mtx);
- return (SEGP_FAIL);
- }
seg_plocked_window += npages;
}
seg_plocked += npages;
mutex_exit(&seg_pmem_mtx);
--- 820,829 ----
*** 946,956 ****
int hlinks = 0;
int hlix;
pcache_link_t *hlinkp;
pcache_link_t *hlnextp = NULL;
int lowmem;
- int trim;
ASSERT(seg_phashsize_win != 0);
/*
* if the cache is off or empty, return
--- 935,944 ----
*** 959,969 ****
return;
}
if (!force) {
lowmem = 0;
- trim = 0;
if (freemem < lotsfree + needfree) {
spgcnt_t fmem = MAX((spgcnt_t)(freemem - needfree), 0);
if (fmem <= 5 * (desfree >> 2)) {
lowmem = 1;
} else if (fmem <= 7 * (lotsfree >> 3)) {
--- 947,956 ----
*** 976,989 ****
3 * (availrmem_initial >> 2)) {
lowmem = 1;
}
}
}
! if (seg_plocked_window >= 7 * (seg_pmaxwindow >> 3)) {
! trim = 1;
! }
! if (!lowmem && !trim) {
return;
}
npgs_to_purge = seg_plocked_window >>
seg_pshrink_shift;
if (lowmem) {
--- 963,973 ----
3 * (availrmem_initial >> 2)) {
lowmem = 1;
}
}
}
! if (!lowmem) {
return;
}
npgs_to_purge = seg_plocked_window >>
seg_pshrink_shift;
if (lowmem) {
*** 1107,1117 ****
}
if (!force) {
if (npgs_purged >= npgs_to_purge) {
break;
}
! if (!trim && !(seg_pathr_full_ahb & 15)) {
ASSERT(lowmem);
if (freemem >= lotsfree + needfree) {
break;
}
}
--- 1091,1101 ----
}
if (!force) {
if (npgs_purged >= npgs_to_purge) {
break;
}
! if (!(seg_pathr_full_ahb & 15)) {
ASSERT(lowmem);
if (freemem >= lotsfree + needfree) {
break;
}
}
*** 1468,1496 ****
hp->p_hnext = (struct seg_pcache *)hp;
hp->p_hprev = (struct seg_pcache *)hp;
mutex_init(&hp->p_hmutex, NULL, MUTEX_DEFAULT, NULL);
}
- if (segpcache_maxwindow == 0) {
- if (physmegs < 64) {
- /* 3% of memory */
- segpcache_maxwindow = availrmem >> 5;
- } else if (physmegs < 512) {
- /* 12% of memory */
- segpcache_maxwindow = availrmem >> 3;
- } else if (physmegs < 1024) {
- /* 25% of memory */
- segpcache_maxwindow = availrmem >> 2;
- } else if (physmegs < 2048) {
- /* 50% of memory */
- segpcache_maxwindow = availrmem >> 1;
- } else {
- /* no limit */
- segpcache_maxwindow = (pgcnt_t)-1;
- }
- }
- seg_pmaxwindow = segpcache_maxwindow;
seg_pinit_mem_config();
}
/*
* called by pageout if memory is low
--- 1452,1461 ----