Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Jul 2021 01:51:00 +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:  <CDBE4678-7FD0-452F-8754-55F8B82A27F9@gmail.com>
In-Reply-To: <YOydf9F3ROkXqpDp@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> <4C23FE3C-4FC3-41B2-9A6A-5C267CC0A0E0@gmail.com> <YOydf9F3ROkXqpDp@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help


> On 12 Jul 2021, at 22:52, Konstantin Belousov <kostikbel@gmail.com> wrote:
> 
> On Mon, Jul 12, 2021 at 02:55:37PM +0300, Vitaliy Gusev wrote:
>> I guess madvise() should work well even with PAGE_SIZE granularity. Usually a caller doesn’t need to free the whole region. As I reported earlier madvise(PAGE_SIZE) works well in Linux and illumos. 
>> 
>> 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’t work (but works in Linux and illumos), will report it in new thread.
>> 
> 
> I want the confirmation or report that it still did not worked, for the
> case when my latest patch was applied and the test program switched to
> the single call to madvise(2) for the whole region.
> 

Understood,  checked.

Patched kernel with single call of madvise(len, MADV_FREE) from userspace still doesn’t work. The same condition if (obj->backing_object != NULL) is met, but once.

——
Vitaliy Gusev


> After that, I can claim that the problem is understood and might consider
> some solutions.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CDBE4678-7FD0-452F-8754-55F8B82A27F9>