Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Aug 2016 15:31:26 -0500
From:      Karl Denninger <karl@denninger.net>
To:        freebsd-fs@freebsd.org
Subject:   Re: ZFS ARC under memory pressure
Message-ID:  <c3bc6c5a-961c-e3a4-2302-f0f7417bc34f@denninger.net>
In-Reply-To: <20160818202657.GS8192@zxy.spb.ru>
References:  <20160816193416.GM8192@zxy.spb.ru> <8dbf2a3a-da64-f7f8-5463-bfa23462446e@FreeBSD.org> <20160818202657.GS8192@zxy.spb.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a cryptographically signed message in MIME format.

--------------ms020806060003040608060704
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable


On 8/18/2016 15:26, Slawa Olhovchenkov wrote:
> On Thu, Aug 18, 2016 at 11:00:28PM +0300, Andriy Gapon wrote:
>
>> 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 =3D 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 <=3D
>>> 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 v=
ariable
>> 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 va=
lue and
>> its handling might be sub-optimal.
> As I see, totaly not optimal.
> I am create some patch for sub-optimal handling and now test it.
> _______________________________________________
> freebsd-fs@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-fs
> To unsubscribe, send any mail to "freebsd-fs-unsubscribe@freebsd.org"

You might want to look at the code contained in here:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D187594

There are some ugly interactions with the VM system you can run into if
you're not careful; I've chased this issue before and while I haven't
yet done the work to integrate it into 11.x (and the underlying code
*has* changed since the 10.x patches I developed) if you wind up driving
the VM system to evict pages to swap rather than pare back ARC you're
probably making the wrong choice.

In addition UMA can come into the picture too and (at least previously)
was a severe contributor to pathological behavior.

--=20
Karl Denninger
karl@denninger.net <mailto:karl@denninger.net>
/The Market Ticker/
/[S/MIME encrypted email preferred]/

--------------ms020806060003040608060704
Content-Type: application/pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature

MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgMFADCABgkqhkiG9w0BBwEAAKCC
Bl8wggZbMIIEQ6ADAgECAgEpMA0GCSqGSIb3DQEBCwUAMIGQMQswCQYDVQQGEwJVUzEQMA4G
A1UECBMHRmxvcmlkYTESMBAGA1UEBxMJTmljZXZpbGxlMRkwFwYDVQQKExBDdWRhIFN5c3Rl
bXMgTExDMRwwGgYDVQQDExNDdWRhIFN5c3RlbXMgTExDIENBMSIwIAYJKoZIhvcNAQkBFhND
dWRhIFN5c3RlbXMgTExDIENBMB4XDTE1MDQyMTAyMjE1OVoXDTIwMDQxOTAyMjE1OVowWjEL
MAkGA1UEBhMCVVMxEDAOBgNVBAgTB0Zsb3JpZGExGTAXBgNVBAoTEEN1ZGEgU3lzdGVtcyBM
TEMxHjAcBgNVBAMTFUthcmwgRGVubmluZ2VyIChPQ1NQKTCCAiIwDQYJKoZIhvcNAQEBBQAD
ggIPADCCAgoCggIBALmEWPhAdphrWd4K5VTvE5pxL3blRQPyGF3ApjUjgtavqU1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YPPRLkGHYdIOzqla
zYD13MTpdou58qn5KANHq8VS5iJ4A2axET7Niddj4Eu4K72FLS2DjIrrH+1KXtEcPgUxKm8X
1yGhALgdgvIU8Pbs/+YccPmCPX5KUDBOkrW/wcHPytNYKBFWnLlM3cvmSOLnTSVjeNnbpyKQ
jxCvGpV6UfQBNBmBvHw6mh/lpnmwt55Djs2xA8oEnZa37Vg86RpXuzy9IZI0s6Rfz6B7ODuO
hvplmtx7ZtTHCMe+I4HjXQMVxnsAAAAAAAA=
--------------ms020806060003040608060704--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?c3bc6c5a-961c-e3a4-2302-f0f7417bc34f>