lmkd: remove unused LMK_STAT_STATE_CHANGED notification am: 5860e852f8 am: 9260f6fdf4
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2596772 Change-Id: I9e6505aec49e190960395448cc201e22229e87ef Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
9c57dad3d2
|
|
@ -36,7 +36,6 @@ enum lmk_cmd {
|
||||||
LMK_PROCKILL, /* Unsolicited msg to subscribed clients on proc kills */
|
LMK_PROCKILL, /* Unsolicited msg to subscribed clients on proc kills */
|
||||||
LMK_UPDATE_PROPS, /* Reinit properties */
|
LMK_UPDATE_PROPS, /* Reinit properties */
|
||||||
LMK_STAT_KILL_OCCURRED, /* Unsolicited msg to subscribed clients on proc kills for statsd log */
|
LMK_STAT_KILL_OCCURRED, /* Unsolicited msg to subscribed clients on proc kills for statsd log */
|
||||||
LMK_STAT_STATE_CHANGED, /* Unsolicited msg to subscribed clients on state changed */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
25
lmkd.cpp
25
lmkd.cpp
|
|
@ -810,22 +810,6 @@ static void stats_write_lmk_kill_occurred_pid(int pid, struct kill_stat *kill_st
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Write the state_changed over the data socket to be propagated via AMS to statsd
|
|
||||||
*/
|
|
||||||
static void stats_write_lmk_state_changed(enum lmk_state state) {
|
|
||||||
LMKD_CTRL_PACKET packet_state_changed;
|
|
||||||
const size_t len = lmkd_pack_set_state_changed(packet_state_changed, state);
|
|
||||||
if (len == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < MAX_DATA_CONN; i++) {
|
|
||||||
if (data_sock[i].sock >= 0 && data_sock[i].async_event_mask & 1 << LMK_ASYNC_EVENT_STAT) {
|
|
||||||
ctrl_data_write(i, (char*)packet_state_changed, len);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void poll_kernel(int poll_fd) {
|
static void poll_kernel(int poll_fd) {
|
||||||
if (poll_fd == -1) {
|
if (poll_fd == -1) {
|
||||||
// not waiting
|
// not waiting
|
||||||
|
|
@ -2423,7 +2407,6 @@ static int find_and_kill_process(int min_score_adj, struct kill_info *ki, union
|
||||||
struct psi_data *pd) {
|
struct psi_data *pd) {
|
||||||
int i;
|
int i;
|
||||||
int killed_size = 0;
|
int killed_size = 0;
|
||||||
bool lmk_state_change_start = false;
|
|
||||||
bool choose_heaviest_task = kill_heaviest_task;
|
bool choose_heaviest_task = kill_heaviest_task;
|
||||||
|
|
||||||
for (i = OOM_SCORE_ADJ_MAX; i >= min_score_adj; i--) {
|
for (i = OOM_SCORE_ADJ_MAX; i >= min_score_adj; i--) {
|
||||||
|
|
@ -2446,10 +2429,6 @@ static int find_and_kill_process(int min_score_adj, struct kill_info *ki, union
|
||||||
|
|
||||||
killed_size = kill_one_process(procp, min_score_adj, ki, mi, wi, tm, pd);
|
killed_size = kill_one_process(procp, min_score_adj, ki, mi, wi, tm, pd);
|
||||||
if (killed_size >= 0) {
|
if (killed_size >= 0) {
|
||||||
if (!lmk_state_change_start) {
|
|
||||||
lmk_state_change_start = true;
|
|
||||||
stats_write_lmk_state_changed(STATE_START);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2458,10 +2437,6 @@ static int find_and_kill_process(int min_score_adj, struct kill_info *ki, union
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lmk_state_change_start) {
|
|
||||||
stats_write_lmk_state_changed(STATE_STOP);
|
|
||||||
}
|
|
||||||
|
|
||||||
return killed_size;
|
return killed_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
12
statslog.cpp
12
statslog.cpp
|
|
@ -336,16 +336,4 @@ size_t lmkd_pack_set_kill_occurred(LMK_KILL_OCCURRED_PACKET packet,
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t lmkd_pack_set_state_changed(LMKD_CTRL_PACKET packet,
|
|
||||||
enum lmk_state state) {
|
|
||||||
if (!enable_stats_log) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
packet[0] = htonl(LMK_STAT_STATE_CHANGED);
|
|
||||||
packet[1] = htonl(state);
|
|
||||||
|
|
||||||
return 2 * sizeof(int);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* LMKD_LOG_STATS */
|
#endif /* LMKD_LOG_STATS */
|
||||||
|
|
|
||||||
20
statslog.h
20
statslog.h
|
|
@ -83,27 +83,12 @@ struct kill_stat {
|
||||||
/* LMKD reply packet to hold data for the LmkKillOccurred statsd atom */
|
/* LMKD reply packet to hold data for the LmkKillOccurred statsd atom */
|
||||||
typedef char LMK_KILL_OCCURRED_PACKET[LMKD_REPLY_MAX_SIZE];
|
typedef char LMK_KILL_OCCURRED_PACKET[LMKD_REPLY_MAX_SIZE];
|
||||||
|
|
||||||
// If you update this, also update the corresponding stats enum mapping.
|
|
||||||
enum lmk_state {
|
|
||||||
STATE_UNKNOWN = 0,
|
|
||||||
STATE_START,
|
|
||||||
STATE_STOP,
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef LMKD_LOG_STATS
|
#ifdef LMKD_LOG_STATS
|
||||||
|
|
||||||
#define PROC_STAT_FILE_PATH "/proc/%d/stat"
|
#define PROC_STAT_FILE_PATH "/proc/%d/stat"
|
||||||
#define PROC_STAT_BUFFER_SIZE 1024
|
#define PROC_STAT_BUFFER_SIZE 1024
|
||||||
#define BYTES_IN_KILOBYTE 1024
|
#define BYTES_IN_KILOBYTE 1024
|
||||||
|
|
||||||
/**
|
|
||||||
* Produces packet with the change in LMKD state which is used as start/stop boundaries for logging
|
|
||||||
* LMK_KILL_OCCURRED event.
|
|
||||||
* Code: LMK_STATE_CHANGED = 54
|
|
||||||
*/
|
|
||||||
size_t lmkd_pack_set_state_changed(LMKD_CTRL_PACKET packet,
|
|
||||||
enum lmk_state state);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produces packet with the event when LMKD kills a process to reduce memory pressure.
|
* Produces packet with the event when LMKD kills a process to reduce memory pressure.
|
||||||
* Code: LMK_KILL_OCCURRED = 51
|
* Code: LMK_KILL_OCCURRED = 51
|
||||||
|
|
@ -137,11 +122,6 @@ const char* stats_get_task_name(int pid);
|
||||||
|
|
||||||
#else /* LMKD_LOG_STATS */
|
#else /* LMKD_LOG_STATS */
|
||||||
|
|
||||||
static inline size_t
|
|
||||||
lmkd_pack_set_state_changed(LMKD_CTRL_PACKET packet __unused, enum lmk_state state __unused) {
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline size_t
|
static inline size_t
|
||||||
lmkd_pack_set_kill_occurred(LMK_KILL_OCCURRED_PACKET packet __unused,
|
lmkd_pack_set_kill_occurred(LMK_KILL_OCCURRED_PACKET packet __unused,
|
||||||
struct kill_stat *kill_st __unused,
|
struct kill_stat *kill_st __unused,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue