Return to

Optane as Swap Partition


Are you a wizard or something? Since when does a Pi have PCIe slots?

1 Like


Thats what im asking, it seems its not

Unless you want to pay a massive performance penalty. If someone has done this pls tell me how.



The pine64 has pcie OP.



And what is your “general feeling” based on?



You can limit the amount of compressed data via sysfs. To let zRAM go sporadic is a very bad idea. On a device with 3gb of RAM, you’re only going to want to use 512mb. And that’s a standard in general.



The purpose of zRAM is to create a compressed instance in RAM. It still relies on whatever swappiness is set to in order to determine how often it is used. It’s more beneficial (even in modern systems) as it’s much easier for RAM to decompress an instance than it is for the device to decompress an instance on a storage device. There’s no doubt cons to it: your zRAM instance is limited by how much RAM you have, depending on how much you set aside for zRAM, it can carve out a lot of usable RAM, and, at least for the meantime, tasks don’t have much priority (rather or not to compress a task is pretty random in general, swap shares this issue as well).

Swap comes with it’s own issues: you’re limited to whatever interface is being used by the partition, the defaults are highly ineffective on modern systems, and the device being swapped to suffers from a diminished life span. Not to mention, embedded devices can actually suffer in terms of battery life as well as it is much more conservative to compress via RAM.

Also, I’d argue that zRAMs only purpose isn’t just on older devices. Google deploys it on current Chromebooks, it’s used by phone manufacturers (a la El Goog) that know their shit, and as someone that compiles the Linux kernel frequently, I find it much more beneficial. Devices with large amounts of RAM will also see a much larger return here too (granted, devices with heavy amounts of RAM often have amazing RAID arrays where the difference between the two become less apparent).

Your analysis of the history of zRAM was actually pretty interesting as I was unaware of its initial usecase.

Anyway, hope you’re having an amazing day. If you have anything to add, then please let me know.



Believe it or not, using a swap space too big is actually harmful to the device’s performance. The amount used should solely be based off the usecase of the device. If the medium is too big and is written to often (especially with a default swappiness of 60) then you risk a lot of performance degradation.

And that’s another thing. I don’t think it’s quite understood what the value of swappiness actually does and how to properly configure it. It’s often assumed that with a lower value, the disk gets written to less and vice versa. But if you have too low of a value then it defeats the purpose entirely. Swappiness also controls how often PAGES ARE DROPPED FROM CACHE. This can be severely bad if a lower value as if RAM is saturated than only foreground tasks are accounted for. This really hurts performance and this is why, on occasion, your computer can seem so sluggish when working on something intensive. It’s a really important concept to keep in mind when messing with the value and that’s why the default is so high (60).

Hope I helped in some way lol



There being no practical benefit to swap partitions, and swapfiles are more convenient.



The biggest drawback to a swapfile over a partition (at least in my case) is the lack of BTRFS support. There’s also bugs here and there that arise from the use of swapfiles.

Edit: you can use a loop device with BTRFS as per Arch’s wiki but it heavily degrades performance

1 Like


That depends. In some implementations swap-files can get fragmented which degrades performance. Also, if you are using full-disk-encryption, hibernation to a swap-file is much more cumbersome.

So in reality, the downsides over-weigh the benefits in my opinion.

1 Like


Doesn’t work with BTRFS, true enough. No bugs of note with EXT3.

Fragmentation isn’t a real concern as you shouldn’t be actively swapping anyway.

Hibernating with LUKS was fixed in 2018.



That sounds like “ABS not working in your car is not an issue as you shouldn’t be actively needing it anyways”. Sure, you shouldn’t be swapping much but if you do, it should work, at least as well as a swap partition in this case.

I didn’t mean that it does not work but it’s more of a hassle to set up and again I don’t really see a reason why you need it to be a file if you cannot use empty swap space anyways.



You can’t avoid needing brakes, you can avoid swapping.



Then why do you even have swap-space, if you aren’t planning on using it? :wink:



To avoid OOMkiller and a crash if everything goes to hell.



Because it’s clicked to default on the install… duh.

1 Like


swap partitions and swap space files serve the purpose of temporary storage in the event of memory overrun exceeding the amount of system memory.
swap partition setup is built in to most distros by default. and often is customize-able with partition management software.
however with many machines made today they have abundant amounts of install-able memory most often the memory can easily exceed the required amount even under heavy loading, so in many cases swap partition or space is not needed.
but all this depends on the file system requirements and graphics rendering as well.

research the requirements of your OS and whats needed for the programs make up a list of pros and cons, and decide what you want to use.



I have bin running without a swap partition for years, but i finally found a situation where i wish i had a swap:

I was firing up a wm for windows. i wanted to give it 8gb of ram, If i had a swap it would have suspended somethings to the swap giving me instant memory access for the wm, Instead of waiting for the system to free up the memory.