From owner-freebsd-fs@FreeBSD.ORG Tue Jun 8 00:14:29 2010 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1026B106564A for ; Tue, 8 Jun 2010 00:14:29 +0000 (UTC) (envelope-from artemb@gmail.com) Received: from mail-pw0-f54.google.com (mail-pw0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id D7CCD8FC08 for ; Tue, 8 Jun 2010 00:14:28 +0000 (UTC) Received: by pwj1 with SMTP id 1so2168144pwj.13 for ; Mon, 07 Jun 2010 17:14:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=docQGOGeooXh2/Wb2yeWf/H4pTSreSPXF478hBzazG4=; b=ntqQp2WTRrhODBUbKvpH4DnJz5cXXSJoGpFRQ43mSIR/oPAZMTGJVbPxD4azYWjc3c AhBVNJw0OuMDWes083ds9oLElyMX9oJT3TDHGUY/BeIXPPwi51mNa0yGTDR3XVn0Crs4 +0yl+q2c4lZCzgcHN5CjgvcIYG5YcXlW1/Qxc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=kBfAKGJkfOJYrCPa4/h4CLbMloVy0hVUIEGFV0S4JPUac2NKAIUoRFtXk2nI69g+5X /b3212oaT3vyTOYu0F/X+xPDkdkD9J/sJxeX1O77NRBmmjbrryL1UMYCqzOV+8BJrGgF A4u4UzkOGO1wHmymSiPIsbDGdRcWe39SrIEzA= MIME-Version: 1.0 Received: by 10.140.248.7 with SMTP id v7mr12523527rvh.252.1275956068293; Mon, 07 Jun 2010 17:14:28 -0700 (PDT) Sender: artemb@gmail.com Received: by 10.141.40.4 with HTTP; Mon, 7 Jun 2010 17:14:28 -0700 (PDT) In-Reply-To: <20100607232909.GA57423@server.vk2pj.dyndns.org> References: <20100607232909.GA57423@server.vk2pj.dyndns.org> Date: Mon, 7 Jun 2010 17:14:28 -0700 X-Google-Sender-Auth: RzqYfPu2vObfOqlhkkxvNiPUqXI Message-ID: From: Artem Belevich To: Peter Jeremy Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-fs@freebsd.org Subject: Re: ZFS memory usage X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jun 2010 00:14:29 -0000 I believe it's pagedaemon's job to push pages from active list to inactive and from inactive down to cache and free. I have a really ugly hack to arc.c which forces pagedaemon wakeup if ARC sees too much memory on inactive list. How much is too much is defined by a sysctl value. http://pastebin.com/ZCkzkWcs Be warned: it's ugly, it may not work, it assumes too much, it's plain broken, it may ... I'm serious -- I have seen my box locking up when I did manage to exhaust memory. The only reason I'm posting this ugliness at all is bacause of hope that someone more familiar with memory allocation in FreeBSD may be able to suggest better approach. --Artem On Mon, Jun 7, 2010 at 4:29 PM, Peter Jeremy wrote: > Currently, ZFS does not appear to be able to steal memory from the > "inactive" list, whereas NFS and UFS both return "freed" pages to the > "inactive" list. =A0Over time, unless you have a pure ZFS box (with no > NFS), this tends to result in ZFS reporting a memory shortage > (kstat.zfs.misc.arcstats.memory_throttle_count increasing), whilst > there is plenty of "inactive" space. > > What is involved in correcting this? > > At least part of the problem is that > cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c:arc_memory_throttle() > only looks at cnt.v_free_count (number of free pages) when deciding > whether to throttle or not. =A0Is the fix as simple as changing the > test to check (cnt.v_free_count + cnt.v_inactive_count)? > > Assuming that the fix is non-trivial, is there an easy way to transfer > "inactive" memory to the "free" list? =A0The perl hack: > =A0perl -e '$x =3D "x" x 1000000;' > sort-of works - by forcing the VM system into real memory shortage. > Is there a better work-around? > > -- > Peter Jeremy >