FROMLIST: mm: multi-gen LRU: thrashing prevention
Add /sys/kernel/mm/lru_gen/min_ttl_ms for thrashing prevention, as requested by many desktop users [1]. When set to value N, it prevents the working set of N milliseconds from getting evicted. The OOM killer is triggered if this working set cannot be kept in memory. Based on the average human detectable lag (~100ms), N=1000 usually eliminates intolerable lags due to thrashing. Larger values like N=3000 make lags less noticeable at the risk of premature OOM kills. Compared with the size-based approach, e.g., [2], this time-based approach has the following advantages: 1. It is easier to configure because it is agnostic to applications and memory sizes. 2. It is more reliable because it is directly wired to the OOM killer. [1] https://lore.kernel.org/lkml/Ydza%2FzXKY9ATRoh6@google.com/ [2] https://lore.kernel.org/lkml/20211130201652.2218636d@mail.inbox.lv/ Link: https://lore.kernel.org/r/20220309021230.721028-12-yuzhao@google.com/ Signed-off-by:Yu Zhao <yuzhao@google.com> Acked-by:
Brian Geffon <bgeffon@google.com> Acked-by:
Jan Alexander Steffens (heftig) <heftig@archlinux.org> Acked-by:
Oleksandr Natalenko <oleksandr@natalenko.name> Acked-by:
Steven Barrett <steven@liquorix.net> Acked-by:
Suleiman Souhlal <suleiman@google.com> Tested-by:
Daniel Byrne <djbyrne@mtu.edu> Tested-by:
Donald Carr <d@chaos-reins.com> Tested-by:
Holger Hoffstätte <holger@applied-asynchrony.com> Tested-by:
Konstantin Kharlamov <Hi-Angel@yandex.ru> Tested-by:
Shuang Zhai <szhai2@cs.rochester.edu> Tested-by:
Sofia Trinh <sofia.trinh@edi.works> Tested-by:
Vaibhav Jain <vaibhav@linux.ibm.com> Bug: 227651406 Signed-off-by:
Kalesh Singh <kaleshsingh@google.com> Change-Id: I482d33f3beaf7723d2f3eeaaa5b4f12bcb9b48a1
Loading