From owner-freebsd-fs@freebsd.org Thu Aug 18 20:01:33 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 B1E90BBE785 for ; Thu, 18 Aug 2016 20:01:33 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citapm.icyb.net.ua (citapm.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id DD1D11845; Thu, 18 Aug 2016 20:01:32 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citapm.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id XAA16268; Thu, 18 Aug 2016 23:01:24 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1baTVE-000JoD-HQ; Thu, 18 Aug 2016 23:01:24 +0300 Subject: Re: ZFS ARC under memory pressure To: Slawa Olhovchenkov , freebsd-fs@FreeBSD.org, Alexander Motin References: <20160816193416.GM8192@zxy.spb.ru> From: Andriy Gapon Message-ID: <8dbf2a3a-da64-f7f8-5463-bfa23462446e@FreeBSD.org> Date: Thu, 18 Aug 2016 23:00:28 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160816193416.GM8192@zxy.spb.ru> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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: Thu, 18 Aug 2016 20:01:33 -0000 On 16/08/2016 22:34, Slawa Olhovchenkov wrote: > 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? You might have found a real problem here, but I am short of time right now to properly analyze the issue. I think that on illumos 'needfree' is a variable that's managed by the virtual memory system and it is akin to our vm_pageout_deficit. But during the porting it became an artificial value and its handling might be sub-optimal. -- Andriy Gapon