diff options
author | delphij <delphij@FreeBSD.org> | 2011-11-21 20:26:22 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2011-11-21 20:26:22 +0000 |
commit | b669bf1954fe240de70bd19230f605dc0d75d8f2 (patch) | |
tree | 194e573e87d746e8d96a3c8a39ecdff0fe267a87 /sys/fs | |
parent | acf3f7e15ceb20af589d9567b612e8ecff489f4e (diff) | |
download | FreeBSD-src-b669bf1954fe240de70bd19230f605dc0d75d8f2.zip FreeBSD-src-b669bf1954fe240de70bd19230f605dc0d75d8f2.tar.gz |
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
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/tmpfs/tmpfs.h | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/sys/fs/tmpfs/tmpfs.h b/sys/fs/tmpfs/tmpfs.h index e95e3c8..fe00fea 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 |