Announcement

Collapse
No announcement yet.

[PATCH] Protect cache under memory pressure to prevent thrashing, avoid high latency

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • [PATCH] Protect cache under memory pressure to prevent thrashing, avoid high latency

    What is the problem?

    Yes, Linux Does Bad In Low RAM / Memory Pressure Situations On The Desktop

    The solution:

    [PATCH] Protect clean file pages under memory pressure to prevent thrashing, avoid high latency and prevent livelock in near-OOM conditions

    Success story with this patch: https://notes.valdikss.org.ru/linux-...-from-2007/en/

    The patches provide sysctl knobs for protecting the specified amount of clean file pages (CFP) under memory pressure.

    The kernel does not have a mechanism for selectively protecting clean file pages. A certain amount of the CFP is required by the userspace for normal operation. First of all, you need a cache of shared libraries and executable files. If the volume of the CFP cache falls below a certain level, thrashing and even livelock occurs.

    Protection of CFP may be used to prevent thrashing and reducing I/O under memory pressure. Hard protection of CFP may be used to avoid high latency and prevent livelock in near-OOM conditions. The patch provides sysctl knobs for protecting the specified amount of clean file cache under memory pressure.

    The vm.clean_low_kbytes sysctl knob provides best-effort protection of CFP. The CFP on the current node won't be reclaimed uder memory pressure when their amount is below vm.clean_low_kbytes unless we threaten to OOM or have no free swap space or vm.swappiness=0. Setting it to a high value may result in a early eviction of anonymous pages into the swap space by attempting to hold the protected amount of clean file pages in memory. The default value is defined by CONFIG_CLEAN_LOW_KBYTES.

    The vm.clean_min_kbytes sysctl knob provides hard protection of CFP. The CFP on the current node won't be reclaimed under memory pressure when their amount is below vm.clean_min_kbytes. Setting it to a high value may result in a early out-of-memory condition due to the inability to reclaim the protected amount of CFP when other types of pages cannot be reclaimed. The default value is defined by CONFIG_CLEAN_MIN_KBYTES.

    Any questions are welcome.

  • #2
    Is there a guide for noobs like myself showing how to install a patch into a kernel and install it in a distribution? I’ve installed ValdikSS’s Mint XFCE iso and I’d like to try out XanMod with the le9 patch with a different distro with the MATE desktop, like MX MATE. Thanks so much!

    Comment


    • #3
      And I just want to say again how much I appreciate your work on this! Thank you so much!

      Comment


      • #4
        Originally posted by KansaKilla View Post
        I’d like to try out XanMod with the le9 patch with a different distro with the MATE desktop, like MX MATE.
        Just do it! https://xanmod.org/#install_via_terminal

        Comment

        Working...
        X