From owner-svn-src-all@FreeBSD.ORG Mon Nov 21 20:26:22 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C9123106564A; Mon, 21 Nov 2011 20:26:22 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B92618FC0C; Mon, 21 Nov 2011 20:26:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pALKQM3E058444; Mon, 21 Nov 2011 20:26:22 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pALKQMPI058442; Mon, 21 Nov 2011 20:26:22 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201111212026.pALKQMPI058442@svn.freebsd.org> From: Xin LI Date: Mon, 21 Nov 2011 20:26:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227802 - head/sys/fs/tmpfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Nov 2011 20:26:22 -0000 Author: delphij Date: Mon Nov 21 20:26:22 2011 New Revision: 227802 URL: http://svn.freebsd.org/changeset/base/227802 Log: 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 Modified: head/sys/fs/tmpfs/tmpfs.h Modified: head/sys/fs/tmpfs/tmpfs.h ============================================================================== --- head/sys/fs/tmpfs/tmpfs.h Mon Nov 21 20:07:12 2011 (r227801) +++ head/sys/fs/tmpfs/tmpfs.h Mon Nov 21 20:26:22 2011 (r227802) @@ -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