On Nov 05 16:46:32, kolip...@exoticsilicon.com wrote:
> On Fri, Nov 05, 2021 at 06:22:16PM +0100, Jan Stary wrote:
> > On Oct 25 21:21:52, h...@stare.cz wrote:
> > > On Oct 24 12:45:33, h...@stare.cz wrote:
> > > > On Oct 24 11:26:40, s...@spacehopper.org wrote:
> > > > > > > Does the swap partition sd0b actually exist,
> > > > > > > or are you by any chance running these machines swapless?
> > > > > > 
> > > > > > Indeed, I am running without swap.
> > > > > 
> > > > > Ah yes AFAIK that is not really supported.
> > > > 
> > > > Is that specific to arm*? Or some other platforms?
> > > > 
> > > > I have been using this Thinkpad T400 (amd64, 8GB ram) for years
> > > > without having a swap partition, running chrome and everything.
> > > 
> > > Ou of curiosity, I added 8GB of swap to this amd64 machine
> > > with 8GB of RAM, and it started using it while there are
> > > gigabytes of free memory, making e.g. chrome quite sluggish.
> > 
> > I am still puzzled by this.
> > 
> > It seems that on arm64 (the RPI3 and RPI4 at least)
> > one wants to have a swap partition (however small),
> > even if the machine has eniugh RAM (like th 8GB on RPI4),
> > because otherwise processes are getting killed.
> 
> I initially wondered if adding swap really completely mitigated the
> issue, or whether it simply became much more difficult to trigger.
> 
> However after a lot of testing with different workloads, I've not
> been able to reproduce it with even a small swap partition that
> is never used.

Same here:

$ swapctl -l                                                         
Device      512-blocks     Used    Avail Capacity  Priority
/dev/sd0b        32135        0    32135     0%    0

> Also worth noting is that it depends on what the process is doing.
> I've run invocations of md5 -tt on all cores, loading the CPU 100%
> for several hours and not seen a crash.  Yet a kernel compile fails
> within minutes.  Presumably it's because the compiler is manipulating
> a large number of pointers, and quickly tries to make an invalid
> memory access.

I don't know what you mean by that. If a compiler (or any other process
for that matter) "makes an invalid memory access", it should be killed,
regardless of whether swap space exists or not.

> However, interestingly, the outputs from the md5
> processes always seem correct, whereas I would expect them to be
> wrong occasionally if some kind of memory corruption is happening..

I don't think there is any memory corruption,
and have no idea why there would be.

> > On amd64, OTOH, one wants to _not_ have a swap partition, because
> > the system starts to use it, even if there is plenty of RAM
> > (like the 8GB on the Thinkpad T400), slowing things down.
> 
> This is exactly our experience as well.  However, this behaviour of
> using swap to free up physical ram even though there is physical ram
> unused is likely by design

Can someone please conform that?

> and with certain workloads may give better performance.
> For example, a large operation on a database
> generating temporary data in RAM that will not be used immediately

What would be an example of such an operation?

> might benefit from being swapped out in anticipation, so that
> a future memory allocation can be made from physical ram immediately
> without needing to swap out the other data first.

Does OpenBSD do any such "preemptive swapping"?

        Jan

Reply via email to