From owner-svn-src-all@FreeBSD.ORG Sat Aug 30 21:44:33 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 895E44C7; Sat, 30 Aug 2014 21:44:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5A3541D77; Sat, 30 Aug 2014 21:44:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7ULiXX5028878; Sat, 30 Aug 2014 21:44:33 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7ULiWsX028875; Sat, 30 Aug 2014 21:44:32 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201408302144.s7ULiWsX028875@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Sat, 30 Aug 2014 21:44:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r270861 - in head/sys/cddl: compat/opensolaris/kern compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 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: Sat, 30 Aug 2014 21:44:33 -0000 Author: smh Date: Sat Aug 30 21:44:32 2014 New Revision: 270861 URL: http://svnweb.freebsd.org/changeset/base/270861 Log: Ensure that ZFS ARC free memory checks include cached pages Also restore kmem_used() check for i386 as it has KVA limits that the raw page counts above don't consider PR: 187594 Reviewed by: peter X-MFC-With: r270759 Review: D700 Sponsored by: Multiplay Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c head/sys/cddl/compat/opensolaris/sys/kmem.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c Sat Aug 30 20:26:30 2014 (r270860) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c Sat Aug 30 21:44:32 2014 (r270861) @@ -152,7 +152,7 @@ u_int kmem_free_count(void) { - return (vm_cnt.v_free_count); + return (vm_cnt.v_free_count + vm_cnt.v_cache_count); } u_int @@ -169,6 +169,13 @@ kmem_size(void) return (kmem_size_val); } +uint64_t +kmem_used(void) +{ + + return (vmem_size(kmem_arena, VMEM_ALLOC)); +} + static int kmem_std_constructor(void *mem, int size __unused, void *private, int flags) { Modified: head/sys/cddl/compat/opensolaris/sys/kmem.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/kmem.h Sat Aug 30 20:26:30 2014 (r270860) +++ head/sys/cddl/compat/opensolaris/sys/kmem.h Sat Aug 30 21:44:32 2014 (r270861) @@ -66,6 +66,7 @@ typedef struct kmem_cache { void *zfs_kmem_alloc(size_t size, int kmflags); void zfs_kmem_free(void *buf, size_t size); uint64_t kmem_size(void); +uint64_t kmem_used(void); u_int kmem_page_count(void); /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Aug 30 20:26:30 2014 (r270860) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Aug 30 21:44:32 2014 (r270861) @@ -2563,6 +2563,14 @@ arc_reclaim_needed(void) #endif /* sun */ #else +#ifdef __i386__ + /* i386 has KVA limits that the raw page counts above don't consider */ + if (kmem_used() > (kmem_size() * 3) / 4) { + DTRACE_PROBE2(arc__reclaim_used, uint64_t, + kmem_used(), uint64_t, (kmem_size() * 3) / 4); + return (1); + } +#endif if (spa_get_random(100) == 0) return (1); #endif