5

I own an 8GB RAM Dell XPS13 9343; the amount of RAM is the biggest pain of this computer, it's soldered on mainboard. Despite the CPU supporting more RAM, even resoldering bigger ones with firmware modification is not an option due to the mainboard design. So make this computer still useful, I replaced M.2 SATA disk with faster M.2 NVMe one and added two extra swapfiles.

My standard config for internet browsing is 8GM RAM + 8GM swap partition, while on-demand I have two extra swapfiles residing on ext4/(root). This gives me in total 32GB swap. It's also worth mentioning that all filesystems including all swaps reside on encrypted LUKS + LVM. This is intentional as I don't want my RAM to be exposed when the computer is turned off.

This setup generally does work; when I enable a lot of memory hungry (usually Java + browser based content, occasionally a single virtual machine), I just turn on both swapfiles and after all needed apps are launched the total load doesn't exceed 20% CPU and total disk I/O doesn't exceed 20M/s.

Now the question part: whole solution occasionally - once a week, when I use memory intensive task few times a week becomes unstable/unreliable. Sometimes it reboots - not sure if it's kernel panic of some hardware issue but graphic card buffers gets corrupted for less than a second then computer restarts. I'm unable to use kdump-tools to debug kernel panic as thanks to Dell's firmware my UEFI doesn't recognize the NVMe disk and I need to put rEFInd on USB only for the boot stage. The second issue is that occasionally when CPU loads increase and I play music in the background, it starts to stutter along with my X11.

While some parts are expected as this is not decent hardware I'm worried that this load can affect audio buffers and so I'm looking for a way to make this more stable. IMHO the load should affect only userspace apps without making those system-wide problems.

I'm using Ubuntu on it and I'm aware there exists a low-latency kernel but wondering if I can first test some lighter solution which can be switched back and forth at runtime. Like things related to amount of file descriptors or assigning some priorities via cgroups?

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
nusch
  • 61
  • This laptop was designed to be lightweight, not upgradable. Consider buying a more appropriate laptop for your needs. – Michael Hampton Nov 21 '20 at 01:52
  • low-latency kernel is actually worse because you'll spend more time in the kernel space. It's just for real-time purposes. For other usage a normal kernel is much better – phuclv Nov 21 '20 at 04:38

4 Answers4

9

Swap will always be a very inefficient and there isn't really much you can do about that. There are two options you might try: zram and zswap. Both use RAM to make swap a little more usable.

Zram allows you to create a swap from your memory -- it creates a new block device that will be used as swap, but pages saved to it are compressed and you can achieve about 50 % compression rate (so 2 GiB swap on zram is roughly equivalent to 4 GiB swap on disk and much faster). You can have multiple swap devices, so you can have smaller swap in zram with higher priority and bigger swap on disk.

Zswap is similar to zram, but it is just a cache for the swap on disk. Again pages saved in zswap are compressed and written to disk only when zswap reaches its capacity.

8

If you need that much SWAP space you'd better buy a better PC.

SSD disks absolutely don't like being used as SWAP because it leads to their degradation faster.

Speaking of your issue: install and enable earlyoom - that's your distro specific, so I can't say how you can do that.

  • 2
    If you use an SSD only for swap, and plan to replace it in 1-2 years, it could be okay. – user253751 Nov 20 '20 at 16:49
  • neither zram nor earlyroom helped. I would to emphasise - I'm not looking for performance, even not stability but realiability is the most. New hardisk is acceptable in a year but losing data and unability to rely on hardware is not. The crash usually happens when I open new heavy app while already lot of open things. And as I said above the graphic buffors get corrupted and I hear crack in external speakers which is usual during startup and shutdown, the screen goes blank but I'm able to Ctrl+alt+del, no network. – nusch Nov 26 '20 at 00:49
  • All options in /proc/sys/kernel: hardlockup_panic, hardlockup_panic, softlockup_panic, unknown_nmi_panic are set to 0. And the system doesn't reboot until I manually do this. I'm wondering how to catch if this might be a bug in X or some race condition hardware race condition which is visible only during high load on PCIe bus due to NVMe load. I own a desktop which has broken mainboard design and I can't enable IOMMU with high load on hardisk and GbE because it hangs. When either IOMMU or high load I do seperate - everything works. I really don't want new computer with new problems right now – nusch Nov 26 '20 at 01:07
0

A lighter weight distro is required, since you have insufficient RAM for your "heavyweight" applications.

Jeremy Boden
  • 1,320
  • you don't need to change your car to get better grip on tires – nusch Nov 26 '20 at 00:43
  • But changing your car for a 4WD will improve the grip of your tyres!!! – Jeremy Boden Nov 26 '20 at 15:01
  • yes, and will get me higher price of support - more expensive parts, more expensive maintenance. As in linux - new device - new drivers, new problems, sorry I can't afford the time, I'm using Long Time Suppor Ubuntu on old hardware just because it allows me to decide when it should disturb my work and when I don't have time for that. And here talking about reliability not performance – nusch Nov 27 '20 at 20:51
0

Just for your information in my case this was caused by some bug in linux/ubuntu kernel, after upgrading to the newest one even if the system is ultimately loaded and slow it no longer crashes. https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1906107

nusch
  • 61