From ac3e43e81b624c3c6d6f11916c37a1a234b4eba6 Mon Sep 17 00:00:00 2001 From: ByungSoo Kim Date: Tue, 13 Jun 2017 13:58:01 +0900 Subject: [PATCH] lowmem: add new api for triggering early LMK in swap module MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit If swap devices are almost full, it can make sluggish issue. So, it requries to trigger early LMK in swap modules. And it is necessary to insert LMK type in order to decide whether LMK will kill background applications or find out mallicious system daemons. Change-Id: I6e215f41ec1b3282f15f67f8df81439f9f21fba8 Signed-off-by: ByungSoo Kim Signed-off-by: Paweł Szewczyk --- src/memory/lowmem-handler.h | 1 + src/memory/vmpressure-lowmem-handler.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/memory/lowmem-handler.h b/src/memory/lowmem-handler.h index 3c94bea..0b0d013 100644 --- a/src/memory/lowmem-handler.h +++ b/src/memory/lowmem-handler.h @@ -62,6 +62,7 @@ struct task_info { void lowmem_dbus_init(void); int lowmem_trigger_reclaim(int flags, int victims, enum lmk_type type, int threshold); +void lowmem_trigger_swap_reclaim(enum lmk_type type, int swap_size); void lowmem_change_memory_state(int state, int force); void lowmem_memcg_set_threshold(int idx, int level, int value); void lowmem_memcg_set_leave_threshold(int idx, int value); diff --git a/src/memory/vmpressure-lowmem-handler.c b/src/memory/vmpressure-lowmem-handler.c index 2ed16a8..862dd51 100644 --- a/src/memory/vmpressure-lowmem-handler.c +++ b/src/memory/vmpressure-lowmem-handler.c @@ -1738,6 +1738,18 @@ int lowmem_trigger_reclaim(int flags, int victims, enum lmk_type type, int thres return 0; } +void lowmem_trigger_swap_reclaim(enum lmk_type type, int swap_size) +{ + int size, victims; + + victims = num_max_victims > MAX_PROACTIVE_HIGH_VICTIMS + ? MAX_PROACTIVE_HIGH_VICTIMS : num_max_victims; + + size = memcg_root->threshold_leave + swap_size; + _I("reclaim from swap module, type : %d, size : %d, victims: %d", type, size, victims); + lowmem_trigger_reclaim(0, victims, type, size); +} + static bool lowmem_fragmentated(void) { struct buddyinfo bi; -- 2.7.4