Live data from Hacker News

A warning about 5.12-rc1

lwn.net

51–60 of 115 posts

Re: A warning about 5.12-rc1

#51
post #2

Linus really does write beautifully. Love his style, concise, easily readable, frank, honest with nice human touches.

> So I'm not blaming the developers in question,

Much kinder than past Linus writings. I loved it too. "Double ungood" works at least as good as the swearing.

Re: A warning about 5.12-rc1

#52
post #11

Earlier quoted context omitted.

Swapfiles are quite common when you use FDE (say, LUKS) and you don't want your swap to be in plaintext on disk. (Although, you could just have an entire LUKS-encrypted swap volume instead of a swapfile...)

While maybe not the most performant my favorite is LVM2 on top of a single large LUKS-encrypted partition (+no boot partition and a single (custom platform key) signed EFI bootable kernel blob containing the initram fs in the EFI partition). This: - Allows a encrypted swap partition (on in lvm2 on top of luks, sure not perfect but I don't really use swap) - Allows hibernation (which I don't really use tbh.) - Fully e…

This is my setup as well.

Re: A warning about 5.12-rc1

#53
Why are swap files/partitions constant size?

Most of the time, I don't need any swap at all, and any swap file/partition is wasted space.

While hibernated, I need ~the amount of system ram as swap.

While running some horrendous matlab script, I need about 1TB of swap.

Yet linux won't dynamically allocate it like other files. I'm forced to constantly resize it manually to save space or be able to do more things.

Re: A warning about 5.12-rc1

#54
post #8

I guess because I use a swapfile I am not normal according to Linus? Haha, I just find it easier to use a swap file when dual-booting Windows and my Linux install is encrypted. Otherwise, it'd me more work to ensure my swap partition is encrypted.

Dual boot is probably not typical for people who install rc kernels right away? I remember trying to do kernel dev on a dual-boot laptop in college, and I spent a lot of time trying to repair the bootloader while running off of a live-USB environment. Besides, most Linux installs by the numbers are probably web servers/data centers, or large enterprises (think movie studios, large tech companies). I realize this come…

For a while I was running linux and windows on the same computer but on different hard drives. To switch systems I shut it down and used hard switches (special hardware in a disk drive slot) to power off/on the right hard drives.

This way you only need one computer, but can have multiple completely separated OS'es. Of course, this doesn't work for laptops.

Re: A warning about 5.12-rc1

#55
post #6

this is unlikely to hurt you unless you use a swap file , rather than a dedicated swap partition. for performance reasons most any modern linux installation would be using a dedicated swap partition, that is defined as swap-only during the install process with mkswap In my experience some of the reasons for using a swap file were more common maybe 10 or 15 years ago. Nowadays with disk space being less costly and rar…

If you are using budget vps, it is likely you will want to enable it. Because vps tend to not setup a swap partition at all. And you are unlikly to reformat a vps to add a swap partition.

Or use zswap on budget VPS.

Re: A warning about 5.12-rc1

#56

Why are swap files/partitions constant size? Most of the time, I don't need any swap at all, and any swap file/partition is wasted space. While hibernated, I need ~the amount of system ram as swap. While running some horrendous matlab script, I need about 1TB of swap. Yet linux won't dynamically allocate it like other files. I'm forced to constantly resize it manually to save space or be able to do more things.

Possibly because it's hard to guarantee re-allocating/sizing will not require more RAM during the process on any given filesystem...

Re: A warning about 5.12-rc1

#57

> And, as far as I know, all the normal distributions set things up with swap partitions, not files I guess Ubuntu is not a "normal" distribution then? Because it uses a swap file by default.

While it's the default setup of the auto installer it common (and IMHO best) practice to change it to install with a swap partition. It's just that it's much easier for anyone who just gets started with Linux to have a swap file. For example for hibernation you swap partition needs to have the right size. But people do upgrade their desktop RAM and as such would need to resize the partition, which isn't easy (because…

I used to use a swap partition, but then if you get the partition size wrong you're lumbered with it. Why wouldn't you use a file.

At one point in the past I used the default (or recommended) /boot size and got stuck a couple of years later juggling at updates to fit the boot files into the partition. I just use a monolithic partition per OS per disk now and swap files within that. Is that not good practice (for home systems)?

Re: A warning about 5.12-rc1

#58
post #23

Earlier quoted context omitted.

Why do you believe that’s the commit that caused the bug?

The second commit self-disambiguates with "swap: fix swapfile read/write offset" and the commit message notes "fixes: 48d1543", which is the first linked commit.

Thanks for answering the question

Re: A warning about 5.12-rc1

#59
post #6

this is unlikely to hurt you unless you use a swap file , rather than a dedicated swap partition. for performance reasons most any modern linux installation would be using a dedicated swap partition, that is defined as swap-only during the install process with mkswap In my experience some of the reasons for using a swap file were more common maybe 10 or 15 years ago. Nowadays with disk space being less costly and rar…

If you are using budget vps, it is likely you will want to enable it. Because vps tend to not setup a swap partition at all. And you are unlikly to reformat a vps to add a swap partition.

I use swap files on all my VPS, even the ones that give me a swap partition - space is cheap as free and it's easy to set a monitor that says "oh wow we're starting to use swap significantly, something's wrong" instead of a "the box OOMKILLed everything, something's wrong".

In fact that just happened - no service died but something used a lot of RAM at midnight - investigating now.

Re: A warning about 5.12-rc1

#60

Why are swap files/partitions constant size? Most of the time, I don't need any swap at all, and any swap file/partition is wasted space. While hibernated, I need ~the amount of system ram as swap. While running some horrendous matlab script, I need about 1TB of swap. Yet linux won't dynamically allocate it like other files. I'm forced to constantly resize it manually to save space or be able to do more things.

I assume the argument to be that it adds complexity (out of swap, what do I do, grow it or something else, if set to grow what if there isn't enough space, if set to grow and there are multiple swap locations which do I grow, ...) that needs to be maintained & tested, but isn't commonly enough needed for someone working on the kernel to decide it warrants that effort, given there are workarounds (i.e. dynamically adding swap partitions/volumes/files) for most of the cases where it might be needed.

> I need about 1TB of swap.

I don't think most people[†] would ever want that much to be dynamically allocated. If something has needed that much memory unexpectedly then it is likely to be something like a massive leak or accidental fork bomb. It could quickly get to the point where a performance drop due to swap thrashing means you can't interact with the system to kill the offending process so your system is effectively locked until either hit the BRB or it runs out of the massive maximum storage allocated to swap. Of course that adds more complexity: how do you decide how much too much is? If it is a user decision and you sometimes want it to be able to balloon that much but still want the OOM killer to deal with accidentally leaky processes at other times, then you are back to manually managing swap allocation before/after processes that are expected to heavily use it.

[†] not that it is wrong to have a use case that warrants it, but if there is a safe workaround for such unusual cases that complicates life just a little, then IMO that is preferable to the risk of adding complexity that will likely go relative untested because it isn't commonly used.

> linux

Of course other OSs have made different decisions on the matter, so maybe there is room for further discussion.

Post reply on HN