Deleted Added
sdiff udiff text old ( 329490 ) new ( 330061 )
full compact
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 4223 unchanged lines hidden (view full) ---

4232static int64_t
4233arc_available_memory(void)
4234{
4235 int64_t lowest = INT64_MAX;
4236 int64_t n;
4237 free_memory_reason_t r = FMR_UNKNOWN;
4238
4239#ifdef _KERNEL
4240 /*
4241 * Cooperate with pagedaemon when it's time for it to scan
4242 * and reclaim some pages.
4243 */
4244 n = PAGESIZE * ((int64_t)freemem - zfs_arc_free_target);
4245 if (n < lowest) {
4246 lowest = n;
4247 r = FMR_LOTSFREE;
4248 }
4249
4250#ifdef illumos
4251 /*
4252 * check that we're out of range of the pageout scanner. It starts to
4253 * schedule paging if freemem is less than lotsfree and needfree.
4254 * lotsfree is the high-water mark for pageout, and needfree is the
4255 * number of needed free pages. We add extra pages here to make sure
4256 * the scanner doesn't start up while we're freeing memory.
4257 */
4258 n = PAGESIZE * (freemem - lotsfree - needfree - desfree);

--- 26 unchanged lines hidden (view full) ---

4285 */
4286 n = PAGESIZE * (availrmem - pages_pp_maximum -
4287 arc_pages_pp_reserve);
4288 if (n < lowest) {
4289 lowest = n;
4290 r = FMR_PAGES_PP_MAXIMUM;
4291 }
4292
4293#endif /* illumos */
4294#if defined(__i386) || !defined(UMA_MD_SMALL_ALLOC)
4295 /*
4296 * If we're on an i386 platform, it's possible that we'll exhaust the
4297 * kernel heap space before we ever run out of available physical
4298 * memory. Most checks of the size of the heap_area compare against
4299 * tune.t_minarmem, which is the minimum available real memory that we
4300 * can have in the system. However, this is generally fixed at 25 pages
4301 * which is so low that it's useless. In this comparison, we seek to

--- 194 unchanged lines hidden (view full) ---

4496 * If we are still low on memory, shrink the ARC
4497 * so that we have arc_shrink_min free space.
4498 */
4499 free_memory = arc_available_memory();
4500
4501 int64_t to_free =
4502 (arc_c >> arc_shrink_shift) - free_memory;
4503 if (to_free > 0) {
4504 arc_shrink(to_free);
4505 }
4506 } else if (free_memory < arc_c >> arc_no_grow_shift) {
4507 arc_no_grow = B_TRUE;
4508 } else if (gethrtime() >= growtime) {
4509 arc_no_grow = B_FALSE;
4510 }
4511

--- 3324 unchanged lines hidden ---