aboutsummaryrefslogtreecommitdiff
path: root/sys/fs
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2011-11-21 20:26:22 +0000
committerXin LI <delphij@FreeBSD.org>2011-11-21 20:26:22 +0000
commit296a25a2454406834cb947d10c50f8c5239512e6 (patch)
tree194e573e87d746e8d96a3c8a39ecdff0fe267a87 /sys/fs
parentcf00e5c6b724b8562093b03b15bff187f109ee61 (diff)
downloadsrc-296a25a2454406834cb947d10c50f8c5239512e6.tar.gz
src-296a25a2454406834cb947d10c50f8c5239512e6.zip
Improve the way to calculate available pages in tmpfs:
- Don't deduct wired pages from total usable counts because it does not make any sense. To make things worse, on systems where swap size is smaller than physical memory and use a lot of wired pages (e.g. ZFS), tmpfs can suddenly have free space of 0 because of this; - Count cached pages as available; [1] - Don't count inactive pages as available, technically we could but that might be too aggressive; [1] [1] Suggested by kib@ MFC after: 1 week
Notes
Notes: svn path=/head/; revision=227802
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/tmpfs/tmpfs.h5
1 files changed, 1 insertions, 4 deletions
diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h
index e95e3c80f6f7..fe00fea0c91c 100644
--- a/sys/fs/tmpfs/tmpfs.h
+++ b/sys/fs/tmpfs/tmpfs.h
@@ -502,11 +502,8 @@ int tmpfs_truncate(struct vnode *, off_t);
static __inline size_t
tmpfs_mem_info(void)
{
- size_t size;
- size = swap_pager_avail + cnt.v_free_count + cnt.v_inactive_count;
- size -= size > cnt.v_wire_count ? cnt.v_wire_count : size;
- return size;
+ return (swap_pager_avail + cnt.v_free_count + cnt.v_cache_count);
}
/* Returns the maximum size allowed for a tmpfs file system. This macro