Overcommit_memory logic fails when swap is off
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 7 lines · Josip Loncaric
Hello,
I've found some minor logic flaws in
mmap.c::vm_enough_memory()which you may want to fix. The problem is simple:overcommit_memorystrategies "2" and "3" misbehave on machines operated without swap space. Strategy "2" results in a very restrictive memory policy, while strategy "3" crashes the system because no memory can be allocated whentotal_swap_pagesis zero. May I suggest that
The behaviour it provides is correct and intentional. The documentation is also quite plain on the fact you need swap for mode 3.
Since the kernel needs memory for its own purposes you cannot run swapless with no overcommit and allow user space all of memory.
2.5 propses including the ability to set the %age between the 0% of mode 3, the 50 of mode 2 and upwards to things relevant in some embedded system cases. So for 2.6 you will be able to tune it in different ways according to precise understanding of workload.
As far as your hang goes I'd grab a standard 2.4.19 or 2.4.19-ac4 kernel and try that.
Quoted 4 lines · Alan Cox
2.5 propses including the ability to set the %age between the 0% of mode 3, the 50 of mode 2 and upwards to things relevant in some embedded system cases. So for 2.6 you will be able to tune it in different ways according to precise understanding of workload.
Alan, hch or someone asked if it would be possible to merge the 2.5 behavior into 2.4-ac ... are you interested or do you not want to break compatibility?
Note for "mode 2" the behavior is identical. For "mode 3" they would also need to set vm_memory_ratio to "0".
If you are willing, I'll send you a diff...
Robert Love
Quoted 6 lines · Robert Love
Alan, hch or someone asked if it would be possible to merge the 2.5 behavior into 2.4-ac ... are you interested or do you not want to break compatibility?
Note for "mode 2" the behavior is identical. For "mode 3" they would also need to set
vm_memory_ratioto "0".
Obvious thing to do would be to add the 2.5 feature once its in a Linus released 2.5 and clearly stable, and make mode 2 mode 3 overwrite that value when you set them the old way.
I'm happy for that