Page 1 of 2

Swap issue also on Update 4 ?

Posted: Sat Jan 07, 2012 12:00 pm
by samo79
I know that this argument was already covered in many places however i test again the swap functionality copying some files on RAM disk (but now using Update 4) but after i exceed the amount of my physical memory (that is 1 GB) all i get is the usual freeze

My system is:

SamFlex 800 Mhz
1 GB RAM
AmigaOS 4.1 Update 4 (Kernel 53.25)

And this is my swap settings:

http://imageshack.us/photo/my-images/805/swap.png/

Re: Swap issue also on Update 4 ?

Posted: Sat Jan 07, 2012 12:23 pm
by Hypex
I also get a freeze when my VRAM gets too low. The system stutters then mouse freeze. Can reboot, no crashlog.

Sometimes a USB mouse/KB and bring it back. Sorry tihs slightly off topic.

Re: Swap issue also on Update 4 ?

Posted: Sat Jan 07, 2012 5:43 pm
by ssolie
You are likely locking all memory. When this happens the system will freeze and this is normal for the swapper and always has been that way. There is no "fix" because there is nothing he OS can do when you force this situation. Apps should avoid using shared memory because it is locked and eats up available address space.

Re: Swap issue also on Update 4 ?

Posted: Sat Jan 07, 2012 7:35 pm
by kas1e
Imho, system never should freezes, and better to have ugly workorounds (like even linux do, or kind), in compare with freezes. System should handle all the problematic parts, and when its need it, some how inform user about, or do something tasty, which in end will not results as freeze. What the reassons to call swapping as swapping, if it just not swapping but freezing ? Sure , apps should do or not do something, but if still they do, OS by itself should handle problematic moments and workoround them.

And, to add, as i know on update2 swapping still works somehow, but start to freeze in update3 and in update4.

Re: Swap issue also on Update 4 ?

Posted: Sat Jan 07, 2012 7:38 pm
by samo79
ssolie wrote:You are likely locking all memory. When this happens the system will freeze and this is normal for the swapper and always has been that way. There is no "fix" because there is nothing he OS can do when you force this situation. Apps should avoid using shared memory because it is locked and eats up available address space.
Hi Steven thanks for reply :-)
Yep of course this is a force situation for sure (it serve me for this test only) but i have a question at this point: where is the difference between fill the memory copying files in RAM and using the OS "for real" finishing the phisical memory with many apps opened ?

I think the result might be the same as memory are used exact the same, or not ?

I didn't try to open many apps at the same time to fill my entire mem (for a real test can say!) just because i have 1 GB installed (a lot of memory in general for AmigaOS) but i can do without any freeze eventually ?

Also why all that freeze ? how about adding and error message and just skip in that case ?
Isn't better ?

@Hypex
No problem ;)

Re: Swap issue also on Update 4 ?

Posted: Sun Jan 08, 2012 9:40 am
by Raziel
@ssolie

Just a little question.

Would it also be a "forced" situation (or maybe simply a bug with the lha program) if i pack a lha with files which size's exceeding my RAM (512MB)?

I get a slowdown from lha first (Can be seen by the packing algorythm counting the bytes in shell - slower) and after a few more MB's into the SWAP freezing?

Also (but thats slightly OT) the game i referred to in my Bug report (Aquaria) is still freezing, not THAT bad as with upd3, but still (can be a bug in the game though, that's why i said OT)

Hmm, i need to test UnArc with huge .lha's...

Re: Swap issue also on Update 4 ?

Posted: Sun Jan 08, 2012 1:52 pm
by ZeroG
ssolie wrote:You are likely locking all memory. When this happens the system will freeze and this is normal for the swapper and always has been that way. There is no "fix" because there is nothing he OS can do when you force this situation. Apps should avoid using shared memory because it is locked and eats up available address space.
Maybe i miss something here, but the memory used by ram-handler to store files should always be swapable, or?

Re: Swap issue also on Update 4 ?

Posted: Sun Jan 08, 2012 11:33 pm
by Deniil
ssolie wrote:You are likely locking all memory. When this happens the system will freeze and this is normal for the swapper and always has been that way. There is no "fix" because there is nothing he OS can do when you force this situation. Apps should avoid using shared memory because it is locked and eats up available address space.
That's silly. When the system cannot allocate memory it should return NULL, and that's it. AmigaOS has always worked that way and all Amiga programs can handle it (except a few bad ports maybe).
Freeze!? WTF is that..?!

Just because AmigaOS suddenly has swapping, then returning NULL is not an option, but freezing the OS is the "better" way to do it, eh? :-? Come on! You can do better, I know it :-)

Btw. Why does RAM disk use shared memory, since filling it up causes this "forced" situation?

Re: Swap issue also on Update 4 ?

Posted: Fri Jan 13, 2012 10:39 pm
by samo79
@denill

Just found this reply from Thomas Frieden and seems (maybe) really usefull to understand our problem:
Why MEMF_VIRTUAL ? Have you actually checked the autodocs ? If yes, where does it even mention MEMF_VIRTUAL ?

MEMF_VIRTUAL is NOT for memory allocations. Use either MEMF_SHARED or MEMF_PRIVATE. Using MEMF_VIRTUAL will make use of the default memory type MEMF_SHARED.

And there's your problem. MEMF_SHARED allocates memory that is automatically locked in memory. This can NOT be paged out. In other words, you basically fill the whole memory and lock it in place. Yes, this will lead to a lockup at one point because there simply is no way to page anything in or out if all memory ends up being locked. Linux "solves" this by killing off random processes and re-using their memory. AmigaOS does not have memory ownership, so there is NOTHING that can be done once this situation arises.
http://forum.hyperion-entertainment.biz ... =666#p8185

So in short (for what i can understand as plain user with very little tech knowledge) our problem is that RAM disk use that shared memory (MEMF_SHARED = shared memory ?) so it will no swappable at all and it will freeze instead when we try to fill the RAM disk directory ...

This until they add such "killing off random process" (Linux style)

What i don't understand is why RAM disk use this kind of shared memory if it will prevent us to swap from RAM, i think RAM should be exactly the right place when the system should swap normally, conversely i really don't understand where OS4 can swap ... infact i don't understand how all that VM thing work under AmigaOS4 :roll:

Pardon if i wrote crap, i just try to understand !

Re: Swap issue also on Update 4 ?

Posted: Fri Jan 13, 2012 11:58 pm
by tonyw
Yes, one of the problems is the type of storage that RAM uses (MEMF_SHARED). If it were MEMF_PRIVATE, then the memory occupied by the RAM Disk could be swapped out to allow other data into RAM. But that means a quantum change in the way that RAM has been understood in the past - for instance, what happens if you load a program into RAM, execute it from RAM, and the first thing it does is to fill the RAM disk with big photos? Can the program itself be swapped out? What happens if it is? How can you prevent it being swapped out? The program is only another file, after all.

Unfortunately, RAM's storage is only part of it. I've tried changing RAM to allocate only MEMF_PRIVATE, and it is not a cure-all, there are other effects still there, that may not be caused by the ram-handler.

As I said, a simple change won't fix the problem.
We're working on it.