submitted 13 hours ago* (last edited 13 hours ago) by to c/linux@lemmy.world
 

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.

all 27 comments

sorted by: hot top controversial new old
[–] 12 points 13 hours ago (3 children)
  • [+] [S] -11 points 12 hours ago* (last edited 11 hours ago) (2 children)

    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.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 6 points 11 hours ago (1 child)

    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.

  • source
  • hideshow 1 child comment
  • [–] [S] -5 points 11 hours ago* (last edited 11 hours ago)

    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.

  • source
  • parent
  • [–] 2 points 9 hours ago (1 child)

    Try changing your io scheduler.

  • source
  • hideshow 1 child comment
  • [–] [S] -2 points 8 hours ago*

    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.

  • source
  • parent
  • [–] 6 points 12 hours ago (2 children)

    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.

  • source
  • hideshow 2 child comments
  • [–] 3 points 12 hours ago

    "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.

  • source
  • parent
  • [+] [S] -8 points 11 hours ago*

    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?

  • source
  • parent
  • [–] 3 points 13 hours ago (1 child)

    yeah linux is completely unusable bro /s

  • source
  • hideshow 1 child comment
  • [–] 2 points 12 hours ago (1 child)

    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.

  • source
  • hideshow 1 child comment
  • [–] [S] -3 points 12 hours ago*

    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.

  • source
  • parent
  • [–] 0 points 8 hours ago

    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.

  • source
  • [–] 1 point 12 hours ago (10 children)

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

  • source
  • hideshow 10 child comments
  • [+] [S] -14 points 12 hours ago* (9 children)

    Thanks, this is very helpful. I'm cured now.

  • source
  • parent
  • hideshow 9 child comments
  • [–] 3 points 10 hours ago (8 children)
  • [+] [S] -7 points 9 hours ago* (last edited 7 hours ago) (7 children)

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

  • source
  • parent
  • hideshow 7 child comments
  • [–] 1 point 7 hours ago (6 children)

    Right .. sorry for trying to help I guess.

  • source
  • parent
  • hideshow 6 child comments
  • [–] [S] -2 points 6 hours ago (5 children)
  • [–] 1 point 5 hours ago (4 children)

    HDDs are slower than SSDs.

    Youre doing heavy data movements.

    You then decide to attack me.

    ????

  • source
  • parent
  • hideshow 4 child comments
  • [–] [S] -2 points 4 hours ago* (3 children)

    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.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 1 point 3 hours ago* (last edited 3 hours ago) (2 children)

    “why is this slow” - “cause its on an hdd”

    what more do you want? why are you so upset and angry? take a couple deep breaths. youve got this, buddy. you can get through it. no need to take out your impotence on random internet strangers.

  • source
  • parent
  • hideshow 2 child comments
  • [–] [S] 0 points 22 minutes ago* (1 child)

    Wow, you have such amazing technical knowledge. You're a sysadmin, I presume? Do you do freelance work? Your outstanding expertise must be made available to the masses.

    Just to check, you know the difference between the disk and the CPU, right? And of course, you can say why one would be busy when the other is engaged.

  • source
  • parent
  • hideshow 1 child comment