Spyke

Syndicated from the fediverse. Read and engage on the original instance.

View original on lemmy.world

How is Linux Mint always disk-bound?

I'm a programmer by trade with twenty years of experience, having first used Linux in 2004 (iirc), and I thought I knew the game pretty well. There are CPU-bound tasks, memory-bound tasks, network-bound tasks, and disk-bound tasks. I'm doing async programming and it's working fine, offloading i/o to the kernel while my app is doing cpu stuff. Except, I'm now using a laptop with 8 GB of memory and Linux Mint-Cinammon on HDD as my main machine, and somehow shit is constantly in the swap and waits for the disk. Right now I'm moving a Windows partition, I have quit everything except four Firefox tabs, Emacs, and Double Commander — and I still think I might kill myself before the ordeal is over. The entire system is completely and totally fucked. Barely anything moves, nothing responds in any kind of a timely fashion. Emacs freezes when typing, with two open buffers. Audio playback stutters. VPN is nonresponsive. I closed all the hundreds of buffers in Emacs, I set the priority and io priority of Gparted to the minimum, and the other apps to the max. I set swappiness to zero, and turned off the swap altogether with swapoff. All of this barely helps. I'm drunk right now, and still this affair bugs me beyond measure. I could maybe deal with this as a one-time thing if swapping and disk i/o weren't incapacitating the system every day.

Is Linux kernel so ridiculously single-threaded that any i/o cripples the entire thing? Or is something tuned horribly wrong in Mint by default? Can I unfuck this somehow? I live close to a river, I can't take this much temptation.

View original on lemmy.world
-9

28 replies

lemmy.world

Of course, because any and all discussion of Linux is dick-measuring, and never actual questions. Someone actually having a problem? Imagine that! It would be so ridiculous.

-13

Apparently you don't grasp the difference between the disk, the CPU and the memory. Learn some shit before commenting on the web.

-8
lemmy.zip

Right now I’m moving a Windows partition

This may have something to do with the unresponsive HDD

I’m drunk right now

The other thing that may cause this symptoms.

8

"I'm completely saturating disk I/O and I have no idea why it's slow"

No shit dude you're reading and writing tens of gigabytes to the same disk you're trying to do other stuff on. Of course it's going to be slow. That's like worst case scenario. Look at whatever system monitor Mint uses and you'll see.

4

True, me being drunk definitely explains why the system has to work like shit for five hours straight. Curiously, it doesn't behave like that on other days when I'm plastered but amn't moving partitions around. Odd thing, isn't it?

-9
lemmy.world

The Linux kernel (and windows btw) often lock threads to the completion of reads or writes to disk. When your primary drive is a spinner and you saturate it's bandwidth with a long-running copy (your from windows copy) you take those normally short processes and add the latency penalty of a thrashing disk to every lock.

Yes you can fix this by moving the entire kernel and operating system into ram at boot, but with 8gb you probably don't want to do that, especially when a couple of Firefox tabs will fill that up pretty quickly.

The solution is drop the gui, load the os into ram and disable logging, or be patient, and don't expect any modern operating system to hold up when you are running long copies against a high-latency root disk.

6
lemmy.world

Yeah, I do know that i/o is mostly single-threaded (except maybe for when multiple disks are involved, not sure about that). However I'm baffled as to why the entire system is impaired when i/o is done. It feels like the kernel has only one thread doing anything, and the userspace apps are constantly tugging on the kernel for some reason. It makes no sense. Userspace apps should be running on the CPU without the kernel's involvement, but for some reason they don't. I have eight cores (with hyperthreading) doing fuckall when the disk is busy.

-5

That is... not remotely how any of that works. Do you want a deeper dive into this?

1

Interesting, somehow I missed the fact of the existence of different i/o schedulers, although I knew about the cpu schedulers. I'm definitely gonna look into this, thanks!

Oddly, the manpage for ionice says that the cpu priority is used as the primary input for the i/o priority, which feels kinda limiting. Perhaps this can be changed.

-2

That would explain things, if I weren't deploying my backend apps on Linux all this time, except for like three years with sysadmins who preferred FreeBSD. Maybe that's my sin, dunno.

-4
piefed.social

You might want to check the SMART stats on the disk, if it's struggling that much, it might be because it's starting to fail. That's assuming it's the internal disk, if it's external, make sure you're using an appropriate port and cable. I've never seen a linux box struggle the way you're describing without it being a hardware problem, but technogy's always throwing up new surprises.

2

Good call, thanks. Though Gparted showed 30+ MB in and 30+ out, for a total of 70 at times, which is pretty good for an hdd in my experience.

However, this doesn't explain why the system is so tied to the disk.

-3
lemmy.world

are you running it from a spinning disk? HDD, not an SSD? Thatd be why its so slow.

1
lemmy.world

Hm? I described it in the post, but I gotta admit my day really went downhill when you showed up.

-7
lemmy.world

HDDs are slower than SSDs.

Youre doing heavy data movements.

You then decide to attack me.

????

1

Such attack, wow.

Thanks for informing me that I could use an SSD if I had a shitton of money for the memory to avoid the swapping so that the SSD wouldn't be smashed to pulp in three months. I could've never guessed that on my own, wow. You're a genius.

-2

Linux Mint usually works well on older hardware. There are limits though and it looks like your PC is simply too old. There are plenty of distros that are specifically designed to work on older hardware. I suggest you try one of those.

0

You reached the end