From owner-freebsd-fs@freebsd.org Tue Aug 16 19:34:20 2016 Return-Path: Delivered-To: freebsd-fs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D68C4BBCCFB for ; Tue, 16 Aug 2016 19:34:20 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (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 9E30E1F3C for ; Tue, 16 Aug 2016 19:34:20 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1bZk7s-000P7Q-88 for freebsd-fs@freebsd.org; Tue, 16 Aug 2016 22:34:16 +0300 Date: Tue, 16 Aug 2016 22:34:16 +0300 From: Slawa Olhovchenkov To: freebsd-fs@freebsd.org Subject: ZFS ARC under memory pressure Message-ID: <20160816193416.GM8192@zxy.spb.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2016 19:34:20 -0000 I see issuses with ZFS ARC inder memory pressure. ZFS ARC size can be dramaticaly reduced, up to arc_min. As I see memory pressure event cause call arc_lowmem and set needfree: arc.c:arc_lowmem needfree = btoc(arc_c >> arc_shrink_shift); After this, arc_available_memory return negative vaules (PAGESIZE * (-needfree)) until needfree is zero. Independent how too much memory freed. needfree set to 0 in arc_reclaim_thread(), when arc_size <= arc_c. Until arc_size don't drop below arc_c (arc_c deceased at every loop interation). arc_c droped to minimum value if arc_size fast enough droped. No control current to initial memory allocation. As result, I can see needless arc reclaim, from 10x to 100x times. Can some one check me and comment this?