Alexey,
I could not test your suggestion on Tru64, because I can not disturb users just for playing with swap. Also Tru64 does not like such kind of experiments on NUMA machines.
But I did it with linux and the outcome should be very similar. I used knoppix-3.8 within qemu and 256M RAM. But I translate the outcome to your 1GB sample for simplicity.
I used the memeater as workhouse too and
used kill -SIGSTOP and -SIGCONT to switch between waiting and running state.
experiment:
1) workhouse stopped, mem=0.5GB, swap=0
2) eater, mem=1GB, swap=0.5GB
3) eater killed, mem~0, swap=0.5GB
4) cont workhouse, mem=0.5GB
as you predicted.
End state is 2, but not exactly as you described!
5b) mem=0.5GB, swap~0.5GB
This is not like in immediate mode.
In immediate mode this part of swap belongs
to workhouse. In our case it can be used
by other process pages. Try additional memeater 1GB run and stop it: mem=1GB, swap=~0.7GB, workhouse runs.
Swap was not reserved for workhouse!
So its simply kind of definition. If the system would show swap=0 it would be also
ok. In both cases (5a and 5b) we dont need disk operations to put workhouse back to swap.
In both cases this part of swap can be reused
by other pages. Thats completly different from immediate mode.
Of course Tru64 can behave different.
The result would be the same,
maxmem=swap+phys.mem.
The difference would
be, that workhouse has to be swapped out
on the next low memory+rest_of_swap condition, whereas
linux can decide to swap other pages out.
Performance would differ and dead locks
are more likely.
Right?
Ralf, what does Tru64 in that experiment?
Happy swapping!
Fighting for a better world with more penguins.