News for hackers. Stuff that matters.
Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by userbinator on Saturday January 28, 2017 @10:39PM (#13511865)
IMHO if you can't not use swap without running out of memory in normal workloads, you either need more RAM or to work on reducing your memory consumption; swapping is for temporary overloads or gracefully recovering from one, not a substitute for RAM.

It's not just a bunch of people setting cm.swappieness to 0 is it? That behaviour changed and now prevents going into swap /ever/ where it used to mean go into swap as a last resort. Changing it to 1 fixes the issue and will act like the old behaviour or only swapping as a last result.

That's a surprising behaviour change (from the perspective of "don't break userspace"), but looks more like a "fix of previously broken behaviour" as in 0 not being able to disable swap entirely; from that perspective, using 1 makes sense.

Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by quotemstr on Saturday January 28, 2017 @10:59PM (#13511971)
I think that the new behavior at zero (documented anywhere?) is a discontinuity. There should be a separate setting for mlocking code pages.

Swap is useful even if you have plenty of RAM. It's better to swap out a cold file-backed page and use that page for cache instead than to pin that cold page in memory for no reason.

Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by quotemstr on Sunday January 29, 2017 @05:28PM (#13517168)
Gah. I meant non-file-backed
Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by mrmondo on Sunday January 29, 2017 @04:56AM (#13513395)
That's what ZRAM is for.
Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by quotemstr on Sunday January 29, 2017 @06:20AM (#13513645)
It's also what swap is for.
Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by feld on Saturday January 28, 2017 @10:50PM (#13511915)
Funny, but Linux is the only unix-like OS I've ever run where using swap means you have a problem. Other OSes have much more intelligent memory management.
Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by brianwawok on Saturday January 28, 2017 @10:55PM (#13511945)
For me swap is an error. I would rather a server crash then go into swap and run slow.

If your servers are at 75% CPU and start swapping you are screwed. Time to start adding servers. In this day and age you are wasting a lot of money to be sitting around waiting for swap.

Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by fpoling on Sunday January 29, 2017 @03:58AM (#13513162)
zswap makes swap useful on the server as it results in gradual slowdown when the system has used all the ram. And if the system runs at 75% of CPU, then there is room for such slowdown.
Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by twic on Sunday January 29, 2017 @04:51AM (#13513380)
I hadn't heard of zswap [0]:

"Zswap is a lightweight compressed cache for swap pages. It takes pages that are in the process of being swapped out and attempts to compress them into a dynamically allocated RAM-based memory pool. [...] Zswap is a new feature as of v3.11 [...] zswap is a work in progress and should be considered experimental."

The return of RAM Doubler!

The naming is initially confusing if you're already familiar with ZFS, especially:

"Zswap makes use of zpool for the managing the compressed memory pool"

[0] https://www.kernel.org/doc/Documentation/vm/zswap.txt

Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by lmns on Sunday January 29, 2017 @09:06AM (#13514158)
It's actually quite useful on many consumer devices, especially those with multiple cores. Most of the time I'm happy I can trade a few CPU cycles for better I/O performance.
Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by mrmondo on Sunday January 29, 2017 @04:56AM (#13513393)
yes, we run ZRAM of every single server we have, its fantastic and we don't have swap anywhere. It's worth noting though that vm.swappiness is set to 0 then ZRAM wont be used, it must be set to 1 or higher unless you're using a really old kernel (pre 3.5).
Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by fpoling on Monday January 30, 2017 @05:41PM (#13525786)
I have found that zswap behaves much better than zram when the size of the used ram approaches 150% of RAM. In theory zram compresses better as zswap has very simple mapping for the location of its cache of compressed pages leading to space underutilization. But, as it has real backing store, it can evict unused pages allowing bigger chunk of uncompressed memory for running applications.
Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by mwpmaybe on Sunday January 29, 2017 @07:43AM (#13513868)
zram[0] is not the same thing as zswap[1].

0. https://en.wikipedia.org/wiki/Zram

1. https://en.wikipedia.org/wiki/Zswap

Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by lima on Sunday January 29, 2017 @08:03AM (#13513932)
It's not the case on Linux either.

Linux intelligently swaps out ununsed pages even if there's enough physical RAM (that is more useful as page cache).

Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by feld on Sunday January 29, 2017 @08:14AM (#13513970)
I have FreeBSD systems that use gigs of swap with gigs of memory free. If you have a Linux system with that much swap usage it's usually about to crash (as it struggling under memory pressure)

People should stop monitoring swap usage and start monitoring the amount of page in / page out IO.

Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by lima on Sunday January 29, 2017 @08:43AM (#13514078)
Not true. I have plenty of Linux systems that use gigabytes of swap with 100+GB of free RAM.

Monitoring swap usage doesn't make sense on either FreeBSD or Linux.

Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by mrmondo on Sunday January 29, 2017 @04:59AM (#13513407)
heh, try using Windows when it goes into swap, Windows both desktop and server additions have the worst memory management I've ever seen and having no ZRAM and a pig of a filesystem like NTFS really doesn't help either.

Going into swap in Linux isn't a problem, it's a symtom of a misconfigured / provisioned server or an unhanled application memory leak, other than that the other only things that should cause it is incorrectly configured use of shared / reserved memory.

Disk based swap should pretty much always be disabled these days and ZRAM used to incresed efficiency.

Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by arthurfm on Sunday January 29, 2017 @07:19AM (#13513801)
> having no ZRAM

Windows 10 has had memory compression [1] for quite a while now. On the PC I am on at the moment with 100+ Chrome tabs open, I have 1.3GB compressed out of a total of 16GB.

[1] http://www.thewindowsclub.com/memory-compression-in-windows-...

Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by lima on Sunday January 29, 2017 @08:44AM (#13514085)
Works very well on Windows Server 2012 and saves massive amounts of money with some workloads.
Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by Amezarak on Sunday January 29, 2017 @09:23AM (#13514224)
Incidentally, at least on Windows, you can save a ton of harddrive space by changing your swap settings - the default is crazy high, especially if you have lots of RAM.
Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by swiley on Sunday January 29, 2017 @12:27AM (#13512347)
My laptop has 8 gigabytes of ram. I can fit all of my personal files in that at obce, I don't see why that's not enough for everything.
Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by edoceo on Sunday January 29, 2017 @01:26AM (#13512595)
Space used on disk is less than when the data is in RAM. It's not a binary copy loaded. It's binary data loaded then inflated into app-object memory. So much overhead
Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by minitech on Sunday January 29, 2017 @04:34AM (#13513319)
I’ve run with 4 GB of memory and no swap for a long time. It’s not hard.
Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by paulddraper on Saturday January 28, 2017 @10:53PM (#13511933)
Swap makes a lot of sense for a consumer device, where I'm opening a big spreadsheet, then putting that in background to edit this video.

It makes less sense for server workloads, where you usually don't have huge chunks of inactive memory.

I always run with no swap in AWS, especially with the newer EBS-only families.

Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by dotancohen on Sunday January 29, 2017 @02:08AM (#13512744)
EBS is a problem because in reality you would be swapping to a network volume. But on a standard VPS server, a bit of swap can really save you some problems. Swap was invented at a time when *NIX was strictly used in a multi-user environment, not far removed from today's webservers but very different from today's consumer devices. It still serves a purpose in that role.
Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by eikenberry on Sunday January 29, 2017 @04:54AM (#13513388)
> [...] a bit of swap can really save you some problems.

And cause a bunch more. Have you ever had to debug a race that is only triggered when a process hits swap. Not fun at all.

Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by sscarduzio on Sunday January 29, 2017 @06:43AM (#13513694)
Yes I did, and the swappy machine started responding just a tad too slowly to other nodes' pings, engaging into a loop of join/parting the cluster, causing replication to kick in all the time and a whole "highly available" critical cluster of 9 nodes was unable to handle traffic (too busy replicating) causing millions in losses. So yeah, don't use swap in servers.

Ironically, if the node had crashed for OoM, the cluster would have survived just fine.

Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by aninhumer on Sunday January 29, 2017 @01:27AM (#13512601)
>"fix of previously broken behaviour" as in 0 not being able to disable swap entirely

But you can disable swap entirely by not having a swap partition/file, so I don't think that's a huge issue.

Re:Ubuntu 16.04: “Out of memory” errors after upgrade to 4.4... by mrmondo on Sunday January 29, 2017 @05:01AM (#13513415)
It was indeed a massive, not well discussed change and the kernel maintainers should have vocalised it better (not that I think the Ubuntu maintainers wouldn't understand it properly anyway TBQH) but yes, the behaviour was previously logically incorrect and had to be fixed at some point.