Bug 230126

Summary: [bmalloc] Add API to release heap's large free
Product: WebKit Reporter: Basuke Suzuki <Basuke.Suzuki>
Component: bmallocAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: fpizlo, ggaren, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 230143    
Bug Blocks:    

Description Basuke Suzuki 2021-09-09 14:58:21 PDT
Our platform has a quota for each apps and that is caused by limiting the virtual address space. If the memory is requested from other part (the part outside WebKit), it will crash. In case of high memory usage, sometime it is useful to release bmalloc's large free region to kernel for others to be ready to assign.
Comment 1 Radar WebKit Bug Importer 2021-09-16 14:59:42 PDT
<rdar://problem/83214563>
Comment 2 Filip Pizlo 2021-09-17 11:02:21 PDT
(In reply to Basuke Suzuki from comment #0)
> Our platform has a quota for each apps and that is caused by limiting the
> virtual address space. If the memory is requested from other part (the part
> outside WebKit), it will crash. In case of high memory usage, sometime it is
> useful to release bmalloc's large free region to kernel for others to be
> ready to assign.

So - the key thing is that you need to actually munmap as opposed to madvise to decommit?
Comment 3 Basuke Suzuki 2021-09-17 11:51:56 PDT
(In reply to Filip Pizlo from comment #2)
> So - the key thing is that you need to actually munmap as opposed to madvise
> to decommit?

Correct.
Comment 4 Filip Pizlo 2021-09-17 11:53:15 PDT
(In reply to Basuke Suzuki from comment #3)
> (In reply to Filip Pizlo from comment #2)
> > So - the key thing is that you need to actually munmap as opposed to madvise
> > to decommit?
> 
> Correct.

That's exciting and terrifying!

I've been engineering mallocs under the assumption that virtual memory is free and munmap is never necessary.

Can you tell me about what your virtual memory quotas look like?

For example, if you have a process that uses 50MB on average and 100MB at peak, what virtual memory quota would you be most likely to give it?
Comment 5 Basuke Suzuki 2021-09-17 15:40:52 PDT
(In reply to Filip Pizlo from comment #4)
> That's exciting and terrifying!

Indeed.

> I've been engineering mallocs under the assumption that virtual memory is
> free and munmap is never necessary.

For my engineer carrier, this is the first case who does have virtual memory and there's hard limit. But yes, it exists.

> Can you tell me about what your virtual memory quotas look like?
> 
> For example, if you have a process that uses 50MB on average and 100MB at
> peak, what virtual memory quota would you be most likely to give it?

Sorry I cannot tell the detail of the system in public. Just let you know PlayStation has power comparable with gaming PC, but the resources allowed to be used for system software are very limited. Games are king in our environment.