msm-4.14/include/linux/simple_lmk.h
Sultan Alsawaf 7b77adf0d3
simple_lmk: Introduce Simple Low Memory Killer for Android
This is a complete low memory killer solution for Android that is small
and simple. Processes are killed according to the priorities that
Android gives them, so that the least important processes are always
killed first. Processes are killed until memory deficits are satisfied,
as observed from kswapd struggling to free up pages. Simple LMK stops
killing processes when kswapd finally goes back to sleep.

The only tunables are the desired amount of memory to be freed per
reclaim event and desired frequency of reclaim events. Simple LMK tries
to free at least the desired amount of memory per reclaim and waits
until all of its victims' memory is freed before proceeding to kill more
processes.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Signed-off-by: azrim <mirzaspc@gmail.com>
2022-04-06 13:20:12 +07:00

27 lines
575 B
C

/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2019 Sultan Alsawaf <sultan@kerneltoast.com>.
*/
#ifndef _SIMPLE_LMK_H_
#define _SIMPLE_LMK_H_
struct mm_struct;
#ifdef CONFIG_ANDROID_SIMPLE_LMK
void simple_lmk_decide_reclaim(int kswapd_priority);
void simple_lmk_stop_reclaim(void);
void simple_lmk_mm_freed(struct mm_struct *mm);
#else
static inline void simple_lmk_decide_reclaim(int kswapd_priority)
{
}
static inline void simple_lmk_stop_reclaim(void)
{
}
static inline void simple_lmk_mm_freed(struct mm_struct *mm)
{
}
#endif
#endif /* _SIMPLE_LMK_H_ */