lmkd: avoid division by zero because of file_base_lru am: c3108416e7 am: b1294d486f am: d2d14448f3
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/1418831 Change-Id: Ic4287b1fb3ef6f7d0100a8e9ee0764b48ce77503
This commit is contained in:
commit
6e9525ad51
5
lmkd.cpp
5
lmkd.cpp
|
|
@ -2424,7 +2424,8 @@ static void mp_event_psi(int data, uint32_t events, struct polling_params *poll_
|
||||||
if (since_thrashing_reset_ms > THRASHING_RESET_INTERVAL_MS) {
|
if (since_thrashing_reset_ms > THRASHING_RESET_INTERVAL_MS) {
|
||||||
long windows_passed;
|
long windows_passed;
|
||||||
/* Calculate prev_thrash_growth if we crossed THRASHING_RESET_INTERVAL_MS */
|
/* Calculate prev_thrash_growth if we crossed THRASHING_RESET_INTERVAL_MS */
|
||||||
prev_thrash_growth = (vs.field.workingset_refault - init_ws_refault) * 100 / base_file_lru;
|
prev_thrash_growth = (vs.field.workingset_refault - init_ws_refault) * 100
|
||||||
|
/ (base_file_lru + 1);
|
||||||
windows_passed = (since_thrashing_reset_ms / THRASHING_RESET_INTERVAL_MS);
|
windows_passed = (since_thrashing_reset_ms / THRASHING_RESET_INTERVAL_MS);
|
||||||
/*
|
/*
|
||||||
* Decay prev_thrashing unless over-the-limit thrashing was registered in the window we
|
* Decay prev_thrashing unless over-the-limit thrashing was registered in the window we
|
||||||
|
|
@ -2442,7 +2443,7 @@ static void mp_event_psi(int data, uint32_t events, struct polling_params *poll_
|
||||||
thrashing_limit = thrashing_limit_pct;
|
thrashing_limit = thrashing_limit_pct;
|
||||||
} else {
|
} else {
|
||||||
/* Calculate what % of the file-backed pagecache refaulted so far */
|
/* Calculate what % of the file-backed pagecache refaulted so far */
|
||||||
thrashing = (vs.field.workingset_refault - init_ws_refault) * 100 / base_file_lru;
|
thrashing = (vs.field.workingset_refault - init_ws_refault) * 100 / (base_file_lru + 1);
|
||||||
}
|
}
|
||||||
/* Add previous cycle's decayed thrashing amount */
|
/* Add previous cycle's decayed thrashing amount */
|
||||||
thrashing += prev_thrash_growth;
|
thrashing += prev_thrash_growth;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue