As part of the memory management changes expected to be merged for the upcoming Linux 6.11 cycle is allowing more fine-tuned control over the swappiness setting used to determine how aggressively pages are swapped out of physical system memory and into the on-disk swap space.

With the new code from Meta, a swappiness argument is supported for memory.reclaim. This effectively allows more finer-grained control over the swapiness behavior without overriding the global swappiness setting.

  • leds@feddit.dk
    link
    fedilink
    arrow-up
    4
    ·
    4 months ago

    I forced a shutdown of my Linux server by holding down the power button last night after it had been thrashing the harddisk for I don’t know how long.

    Wouldn’t respond to SSH so I just gave up, guess I could have tried to plug in a keyboard and use some magic keys.

    Maybe I should just remove the swapfile and let it kill something before it gets to that state. Or is that what swappiness setting is supposed to prevent? Only swap out stuff that is not actively used? In any case defaults don’t seem to work very well for me.

    Guess I’ll have to go boot it again today and try to find out what went wrong from the logs.

    • SWW13@lemmy.brief.guru
      link
      fedilink
      arrow-up
      5
      ·
      4 months ago

      Look into earlyoom or systemd-oomd, the kernel out-of-memory killer will only start killing processes way after it should be. It will happily deadlock itself in a memory swap loop before considering killing any process.

      There are a lot of other ways to fine tune the kernel to prevent this, but it’s a good starting point to prevent your system from freezing. Just keep in mind it will kill processes when memory is running out until enough memory is available.

      • leds@feddit.dk
        link
        fedilink
        arrow-up
        4
        ·
        4 months ago

        Thanks, will have a look for next time , too bad those are not the defaults.

        For now it seems my ssd is fried (even though swap wasn’t on that disk) , lots of I/O Errors and a suspiciously toasted looking chip

        • SWW13@lemmy.brief.guru
          link
          fedilink
          arrow-up
          2
          ·
          4 months ago

          Ouch, hope you can get that sorted out. A broken disk my also “deadlock” the system when binaries it tries to start are on that disk and no longer in cache, e.g. sshd or your shell.

          In my experience when only ping sporadically works it’s an OOM issue, if the ssh login fails weirdly it can also be an I/O issue. If your network is working as expected obviously.