static int lowmem_kill_victims(int max_victims,
enum syscommon_resourced_memory_lmk_oom_level oom_level,
int start_oom, int end_oom, unsigned should_be_freed, int flags,
- unsigned int *total_size, int *completed, unsigned int threshold)
+ unsigned int *total_size, int *completed,
+ unsigned int threshold, int lmk_try_count)
{
int ret;
unsigned int total_victim_size = 0;
if (lmk_governor_post_is_enabled_of_wss()) {
ret = syscommon_plugin_resourced_memory_lmk_get_kill_candidates_post_with_wss(
- lowmem_kill_candidates);
+ lowmem_kill_candidates, lmk_try_count);
if (ret < 0) {
status = LOWMEM_RECLAIM_NEXT_TYPE;
goto leave;
return RESOURCED_ERROR_NONE;
}
-static void lowmem_handle_request(struct lowmem_control *ctl)
+static void lowmem_handle_request(struct lowmem_control *ctl, int lmk_try_count)
{
int start_oom, end_oom;
int count = 0, victim_cnt = 0;
/* precaution */
current_size = 0;
victim_cnt = lowmem_kill_victims(max_victim_cnt, oom_level, start_oom, end_oom,
- reclaim_size_mb, ctl->flags, ¤t_size, &status, ctl->size_mb);
+ reclaim_size_mb, ctl->flags, ¤t_size, &status,
+ ctl->size_mb, lmk_try_count);
if (victim_cnt) {
current_size = KBYTE_TO_MBYTE(current_size);
g_async_queue_ref(lmw->queue);
while (1) {
- int try_count = 0;
+ int lmk_try_count = 0;
struct lowmem_control *ctl;
LOWMEM_WORKER_IDLE(lmw);
LOWMEM_WORKER_RUN(lmw);
process_again:
- _D("[LMK] %d tries", ++try_count);
- lowmem_handle_request(ctl);
+ lmk_try_count++;
+ _D("[LMK] %d tries", lmk_try_count);
+ lowmem_handle_request(ctl, lmk_try_count);
/**
* Case the process failed to reclaim requested amount of memory
* or still under have memory pressure - try the timeout wait.