Date: Mon, 5 Jul 2021 22:47:41 +0300 From: Vitaliy Gusev <gusev.vitaliy@gmail.com> To: Konstantin Belousov <kostikbel@gmail.com> Cc: freebsd-hackers@freebsd.org, gljennjohn@gmail.com, Mark Johnston <markj@freebsd.org>, Peter Grehan <grehan@freebsd.org> Subject: Re: madvise(MADV_FREE) doesn't work in some cases? Message-ID: <2A7A1E60-766D-427B-8288-E92B4090022E@gmail.com> In-Reply-To: <YONVgjgqREDAucok@kib.kiev.ua> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail=_82CC2F6D-5182-4E17-96FC-1768BCE1AE35 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > 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 That caused behaviour that memory is not freed!=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 ? As Mark wrote in another thread: Indeed, in FreeBSD madvise() never reclaims pages. I'm not sure which hint is being provided here, but MADV_DONTNEED and MADV_FREE both prioritize reclamation of the pages backing the specified virtual address range. The difference between the two is that MADV_FREE permits dirty pages to be freed without paging out their contents first and so is destructive. That is why I expected the same behaviour for both. >>>=20 >>> You can read more details in the referenced commit, as well as some = musings >>> about way to make it somewhat better. >>>=20 >>> I must say, that trying to allocated 1/2 + 1/2 of RAM this way, on a = system >>> without swap, is the way to ask for troubles anyway. >> I=E2=80=99ve just notify that other operation systems work well with = that, whereas FreeBSD has troubles. Probably something in madvise() is = not finished ? >=20 > Well, yes, as I said, non-trivial shadow chains for MADV_FREE are not > handled due to the 'old content revival' bug. For your specific case, = the > following patch might help (modulo bugs). Thanks, I will try and report result. =E2=80=94=E2=80=94 Vitaliy Gusev --Apple-Mail=_82CC2F6D-5182-4E17-96FC-1768BCE1AE35--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2A7A1E60-766D-427B-8288-E92B4090022E>