Date: Wed, 14 Jul 2021 00:19:56 +0300 From: Vitaliy Gusev <gusev.vitaliy@gmail.com> To: Ka Ho Ng <khng300@gmail.com> Cc: freebsd-hackers@freebsd.org, gljennjohn@gmail.com, Mark Johnston <markj@freebsd.org>, Peter Grehan <grehan@freebsd.org>, Konstantin Belousov <kostikbel@gmail.com> Subject: Re: madvise(MADV_FREE) doesn't work in some cases? Message-ID: <23BF78E0-CEF9-4B4F-B7C4-6F81DD6DABEE@gmail.com> In-Reply-To: <4cab2b26-e9cb-6ca7-fbd1-90160f07bf61@gmail.com> References: <D5749BDF-36B5-4AE9-A75F-2A702DF71F8C@gmail.com> <20210703065420.6dbafb5f@ernst.home> <D542E8C1-4E97-48E8-8748-BBA19B2216EC@gmail.com> <2390FA9B-319E-45D4-BEA7-10878E43AD4B@gmail.com> <YONVgjgqREDAucok@kib.kiev.ua> <2A7A1E60-766D-427B-8288-E92B4090022E@gmail.com> <4cab2b26-e9cb-6ca7-fbd1-90160f07bf61@gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail=_0039FE7C-4B01-4DAC-817E-424EB4742BA2 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 13 Jul 2021, at 14:03, Ka Ho Ng <khng300@gmail.com> wrote: >=20 > On 2021/7/6 3:47 AM, Vitaliy Gusev wrote: >>> On 5 Jul 2021, at 21:54, Konstantin Belousov <kostikbel@gmail.com> = wrote: >>>=20 >>> On Mon, Jul 05, 2021 at 07:32:00PM +0300, Vitaliy Gusev wrote: >>>=20 >>> DONTNEED does not allow system to free pages at all. It means that = pages >>> are less useful and can be paged out with higher priority. >>>=20 >>=20 >> That caused behaviour that memory is not freed!=20 >>=20 >> Is there a reason why FreeBSD behaviour for MADV_DONTNEED is = different than in Linux and illumos ? Why it needs swap and cannot be = easily dropped ? >>=20 > Illumos has a similar behavior as FreeBSD in the way that it does not > destroy content of the underlying object. The operation you described = in > Illumos is MAP_PURGE which is intended to be a bug-to-bug compatible > interface. See: > = https://github.com/illumos/illumos-gate/commit/8905f42caceb9f470ffaa19e5f6= c9fb6184d12c0 > for full context. >=20 Right, I was confused by RSS value of test processes in illumos, it was = shrunk to hundreds of KB: 2337 vvv 1 59 0 1002M 980K sleep 0:01 0.00% = mmapforkdontnee 2338 vvv 1 59 0 1002M 720K sleep 0:01 0.00% = mmapforkdontnee whereas free memory didn=E2=80=99t increased, so system kept memory = reserved. MADV_FREE increases "free mem" after madvise(), i.e. frees used memory, = that is expected. Thanks, Vitaliy Gusev --Apple-Mail=_0039FE7C-4B01-4DAC-817E-424EB4742BA2--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?23BF78E0-CEF9-4B4F-B7C4-6F81DD6DABEE>