Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Jul 2021 14:55:37 +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:  <4C23FE3C-4FC3-41B2-9A6A-5C267CC0A0E0@gmail.com>
In-Reply-To: <YOmmicfMXPHQ4eY2@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> <2A7A1E60-766D-427B-8288-E92B4090022E@gmail.com> <A3E8A5E9-5912-4358-B384-1FC5847DCBE6@gmail.com> <YOmmicfMXPHQ4eY2@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
Thanks for response,

> On 10 Jul 2021, at 16:54, Konstantin Belousov <kostikbel@gmail.com> =
wrote:
>=20
>>=20
>> After testing it looks that backing_object is not null here, memory =
is not freed and mmapfork test program is still killed. Any ideas?
>>=20
> I finally looked at this thing again.  You do madvise(PAGE_SIZE).  =
With
> my patch (updated version below) issue madvise() for the whole region
> once.

I guess madvise() should work well even with PAGE_SIZE granularity. =
Usually a caller doesn=E2=80=99t need to free the whole region. As I =
reported earlier madvise(PAGE_SIZE) works well in Linux and illumos.=20

Current behaviour in FreeBSD can confuse programmers and brings =
impossibility to effectively give back unused memory. Also I have =
another case with madvise() but with shared memory that also doesn=E2=80=99=
t work (but works in Linux and illumos), will report it in new thread.

=E2=80=94=E2=80=94=E2=80=94
Vitaliy Gusev





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C23FE3C-4FC3-41B2-9A6A-5C267CC0A0E0>