tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: mmap implementation advice needed.



Den 2018-03-30 kl. 16:46, skrev Christos Zoulas:
In article <1ce8eac5-3639-aec1-0e0c-fe857f49bc2c%ludd.ltu.se@localhost>,
Anders Magnusson  <ragge%ludd.ltu.se@localhost> wrote:
Hi tech-kern,

I'm trying to solve PR#28379 and ran into a problem and I don't really
understand how it is supposed to work:
If a process tries to mmap for example a file with a length of just over
1GB it will always succeed as I understand the code, but that may not be
true depending on the underlying hardware, and I cannot find any way to
control this from the MD code...?

On vax, for example, large mmap's cannot be done due to hardware
constraints.
In the above example it will cause the mmap() to succeed, but when
touching the pages it will hang forever since there will never be
available pte's.

So, any advice how a max size of allowed mmap'able memory be controlled?

Notes about vax memory management if someone is wondering:
- 2 areas (P0 and P1) of size 1G each, P0 grows from bottom, P1 grows
>from top (intended for stack).
- The PTEs for KVM must be in contiguous physical memory, hence the
allocation for one process with all of P0 and P1 mapped takes 128k.
- Vax uses VM_MAP_TOPDOWN so that not too much of KVM space is needed
for mmap.
Perhaps we should add a resource limit for contiguous memory allocations.
RLIMIT_MEMCONT?  The actual value can be MD.

That will not solve the problem;  just doing two mmap'is and we were at the same spot again.
The problem is that too much virtual memory can be allocated.

A resource limit for mmap in total would solve the problem though.

-- Ragge




Home | Main Index | Thread Index | Old Index