Re: malloc cache changes

2021-03-09 Thread Otto Moerbeek
On Tue, Mar 09, 2021 at 09:12:03AM +0100, Otto Moerbeek wrote:

> Hi,
> 
> I just committed a malloc change that is interesting. It has been in
> snaps already for a while.
> 
> It changes the malloc cache to be a little more friendly to the
> kernel, mallocs tendency to split large allocations into page-sized ones
> was giving the kernel a hard time in some cases.
> 
> By changing the data structure I am also able to find a proper sized
> block in the cache immediately, instead of searching for it.
> 
> The original cache was very aggressive ununmapping regions. Which is

s/unun/un

> nice to find use-after-frees, but also increases the pressure on the
> kernel. This version is a bit less aggressive.
> 
> The behaviour for malloc option S is unchanged, there you get the
> maximum protection, at the cost of performance. Cache resizing also
> works as before, except that the maximum size of the cache is now
> larger: apart from the default 64 1 page sized regions it also tracks
> a number of bigger regions.
> 
>   -Otto
> 
> 



malloc cache changes

2021-03-09 Thread Otto Moerbeek
Hi,

I just committed a malloc change that is interesting. It has been in
snaps already for a while.

It changes the malloc cache to be a little more friendly to the
kernel, mallocs tendency to split large allocations into page-sized ones
was giving the kernel a hard time in some cases.

By changing the data structure I am also able to find a proper sized
block in the cache immediately, instead of searching for it.

The original cache was very aggressive ununmapping regions. Which is
nice to find use-after-frees, but also increases the pressure on the
kernel. This version is a bit less aggressive.

The behaviour for malloc option S is unchanged, there you get the
maximum protection, at the cost of performance. Cache resizing also
works as before, except that the maximum size of the cache is now
larger: apart from the default 64 1 page sized regions it also tracks
a number of bigger regions.

-Otto