OpenCloudOS-Kernel/include
Kalesh Singh 793b06ed32 mm: Multi-gen LRU: remove wait_event_killable()
commit 7f63cf2d9b upstream.

Android 14 and later default to MGLRU [1] and field telemetry showed
occasional long tail latency (>100ms) in the reclaim path.

Tracing revealed priority inversion in the reclaim path.  In
try_to_inc_max_seq(), when high priority tasks were blocked on
wait_event_killable(), the preemption of the low priority task to call
wake_up_all() caused those high priority tasks to wait longer than
necessary.  In general, this problem is not different from others of its
kind, e.g., one caused by mutex_lock().  However, it is specific to MGLRU
because it introduced the new wait queue lruvec->mm_state.wait.

The purpose of this new wait queue is to avoid the thundering herd
problem.  If many direct reclaimers rush into try_to_inc_max_seq(), only
one can succeed, i.e., the one to wake up the rest, and the rest who
failed might cause premature OOM kills if they do not wait.  So far there
is no evidence supporting this scenario, based on how often the wait has
been hit.  And this begs the question how useful the wait queue is in
practice.

Based on Minchan's recommendation, which is in line with his commit
6d4675e601 ("mm: don't be stuck to rmap lock on reclaim path") and the
rest of the MGLRU code which also uses trylock when possible, remove the
wait queue.

[1] https://android-review.googlesource.com/q/I7ed7fbfd6ef9ce10053347528125dd98c39e50bf

Link: https://lkml.kernel.org/r/20230413214326.2147568-1-kaleshsingh@google.com
Fixes: bd74fdaea1 ("mm: multi-gen LRU: support page table walks")
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
Suggested-by: Minchan Kim <minchan@kernel.org>
Reported-by: Wei Wang <wvw@google.com>
Acked-by: Yu Zhao <yuzhao@google.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
Cc: Oleksandr Natalenko <oleksandr@natalenko.name>
Cc: Suleiman Souhlal <suleiman@google.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: caelli <caelli@tencent.com>
Signed-off-by: Jianping Liu <frankjpliu@tencent.com>
2024-11-28 14:46:14 +08:00
..
acpi tkernel: sync code to the same with tk4 pub/lts/0017-kabi 2024-06-12 13:13:20 +08:00
asm-generic asm-generic: introduce io_stop_wc() and add implementation for ARM64 2024-06-12 13:16:50 +08:00
clocksource clocksource/drivers/arm_arch_timer: Remove any trace of the TVAL programming interface 2024-06-12 13:16:40 +08:00
crypto tkernel: sync code to the same with tk4 pub/lts/0017-kabi 2024-06-12 13:13:20 +08:00
drm tkernel: sync code to the same with tk4 pub/lts/0017-kabi 2024-06-12 13:13:20 +08:00
dt-bindings tkernel: add base tlinux kernel interfaces 2024-06-11 20:09:33 +08:00
keys tkernel: sync code to the same with tk4 pub/lts/0017-kabi 2024-06-12 13:13:20 +08:00
kvm KVM: arm64: pmu: Make overflow handler NMI safe 2024-11-05 17:04:08 +08:00
linux mm: Multi-gen LRU: remove wait_event_killable() 2024-11-28 14:46:14 +08:00
math-emu nds32: Mark expected switch fall-throughs 2019-08-29 11:06:56 -05:00
media tkernel: sync code to the same with tk4 pub/lts/0017-kabi 2024-06-12 13:13:20 +08:00
misc auxdisplay: charlcd: move charlcd.h to drivers/auxdisplay 2019-08-08 19:59:17 +02:00
net net: page_pool: introduce ethtool stats 2024-06-12 13:17:55 +08:00
pcmcia
ras
rdma tkernel: sync code to the same with tk4 pub/lts/0017-kabi 2024-06-12 13:13:20 +08:00
scsi tkernel: sync code to the same with tk4 pub/lts/0017-kabi 2024-06-12 13:13:20 +08:00
soc ock: sync codes to ock 5.4.119-20.0009.21 2024-06-11 20:27:38 +08:00
sound HDA driver support for Phytium desktop 2024-11-28 12:26:14 +08:00
target tkernel: sync code to the same with tk4 pub/lts/0017-kabi 2024-06-12 13:13:20 +08:00
trace page_pool: Add API to update numa node 2024-06-12 13:16:51 +08:00
uapi serial driver support for Phytium desktop and embedded CPUs 2024-11-28 12:26:14 +08:00
vdso tkernel: sync code to the same with tk4 pub/lts/0017-kabi 2024-06-12 13:13:20 +08:00
video tkernel: sync code to the same with tk4 pub/lts/0017-kabi 2024-06-12 13:13:20 +08:00
xen tkernel: sync code to the same with tk4 pub/lts/0017-kabi 2024-06-12 13:13:20 +08:00