lmkd: Add hook for when there are no killable processes am: d256df3c5f am: 1683221f0d
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/3249594 Change-Id: Ica82748265304f240cff3e2dc570fa12e9db4ac1 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
7dff130d87
|
|
@ -50,6 +50,11 @@ bool lmkd_init_hook();
|
||||||
*/
|
*/
|
||||||
int lmkd_free_memory_before_kill_hook(struct proc* procp, int proc_size_pages,
|
int lmkd_free_memory_before_kill_hook(struct proc* procp, int proc_size_pages,
|
||||||
int proc_oom_score, int kill_reason);
|
int proc_oom_score, int kill_reason);
|
||||||
|
/*
|
||||||
|
* Invoked when LMKD has no more candidates to kill at any priority. The hook
|
||||||
|
* may attempt to free memory elsewhere to try to preserve system stability.
|
||||||
|
*/
|
||||||
|
void lmkd_no_kill_candidates_hook();
|
||||||
|
|
||||||
#else /* LMKD_USE_HOOKS */
|
#else /* LMKD_USE_HOOKS */
|
||||||
|
|
||||||
|
|
@ -59,6 +64,7 @@ static inline int lmkd_free_memory_before_kill_hook(struct proc*, int, int,
|
||||||
int) {
|
int) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
static inline void lmkd_no_kill_candidates_hook() {}
|
||||||
|
|
||||||
#endif /* LMKD_USE_HOOKS */
|
#endif /* LMKD_USE_HOOKS */
|
||||||
|
|
||||||
|
|
|
||||||
4
lmkd.cpp
4
lmkd.cpp
|
|
@ -3248,6 +3248,10 @@ do_kill:
|
||||||
|
|
||||||
pages_freed = find_and_kill_process(min_score_adj, NULL, &mi, &wi, &curr_tm, NULL);
|
pages_freed = find_and_kill_process(min_score_adj, NULL, &mi, &wi, &curr_tm, NULL);
|
||||||
|
|
||||||
|
if (pages_freed == 0 && min_score_adj == 0) {
|
||||||
|
lmkd_no_kill_candidates_hook();
|
||||||
|
}
|
||||||
|
|
||||||
if (pages_freed == 0) {
|
if (pages_freed == 0) {
|
||||||
/* Rate limit kill reports when nothing was reclaimed */
|
/* Rate limit kill reports when nothing was reclaimed */
|
||||||
if (get_time_diff_ms(&last_report_tm, &curr_tm) < FAIL_REPORT_RLIMIT_MS) {
|
if (get_time_diff_ms(&last_report_tm, &curr_tm) < FAIL_REPORT_RLIMIT_MS) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue