Re: madvise(MADV_FREE) doesn't work in some cases?
Date: Tue, 13 Jul 2021 11:03:16 UTC
On 2021/7/6 3:47 AM, Vitaliy Gusev wrote: >> On 5 Jul 2021, at 21:54, Konstantin Belousov <kostikbel@gmail.com> wrote: >> >> On Mon, Jul 05, 2021 at 07:32:00PM +0300, Vitaliy Gusev wrote: >> >> 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. >> > > That caused behaviour that memory is not freed! > > 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 ? > 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/8905f42caceb9f470ffaa19e5f6c9fb6184d12c0 for full context. Ka Ho