CS degree is kinda useless, right? I haven't slept the whole night applying and thinking about this...

  • unperson [he/him]
    ·
    9 days ago

    zswap has the same purpose than zram but a better design: it sends to disk the pages that cannot be compressed, and when it gets full it writes them back least recently used first. zram on the other hand keeps uncompressible pages around, and when it gets full all new pages go to disk and it makes the situation worse when you're low on RAM.

    • asante [comrade/them]
      ·
      9 days ago

      woah thanks! i always thought zram was a better solution than zswap but i'll give zswap a try when i get time.

      am i right that you can create zswap block devices and mount them like with zram? (eg. mounting /var/tmp)

      • unperson [he/him]
        ·
        edit-2
        9 days ago

        am i right that you can create zswap block devices and mount them like with zram? (eg. mounting /var/tmp)

        zswap is a "front swap", it needs a backing swap to function that's crucial to the design. It automtically goes in front of all the swaps you have enabled.

        You could probably put the backing swap on a loop device on a tmpfs, but I don't know how it will handle the loopback. It's a better idea to put it on disk. It can be a slow or write-limited disk, it will not get used much. You definitely should not use zram and zswap at the same time.

        • asante [comrade/them]
          ·
          9 days ago

          damn. when i do try out zswap i'll try and do this. but i do a lot of compiling and i prefer not to do all those reads and writes on my hard drive, so i will be sticking with zram for now.

          thanks for the advice! it was hard for me to understand the differences at first when i first started looking at them so your comments are helpful.