lmkd: remove unused LMK_STAT_STATE_CHANGED notification am: 5860e852f8 am: 9260f6fdf4 am: 9c57dad3d2 am: b77b392278 am: feaf9bbc0f

Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/2596772

Change-Id: I26f57abd01695f83fc358af1ef9c8f733450b933
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Suren Baghdasaryan 2023-05-20 04:51:03 +00:00 committed by Automerger Merge Worker
commit bae2dfebb6
4 changed files with 0 additions and 58 deletions

View File

@ -36,7 +36,6 @@ enum lmk_cmd {
LMK_PROCKILL, /* Unsolicited msg to subscribed clients on proc kills */
LMK_UPDATE_PROPS, /* Reinit properties */
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 */
};
/*

View File

@ -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) {
if (poll_fd == -1) {
// 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) {
int i;
int killed_size = 0;
bool lmk_state_change_start = false;
bool choose_heaviest_task = kill_heaviest_task;
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);
if (killed_size >= 0) {
if (!lmk_state_change_start) {
lmk_state_change_start = true;
stats_write_lmk_state_changed(STATE_START);
}
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;
}

View File

@ -336,16 +336,4 @@ size_t lmkd_pack_set_kill_occurred(LMK_KILL_OCCURRED_PACKET packet,
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 */

View File

@ -83,27 +83,12 @@ struct kill_stat {
/* LMKD reply packet to hold data for the LmkKillOccurred statsd atom */
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
#define PROC_STAT_FILE_PATH "/proc/%d/stat"
#define PROC_STAT_BUFFER_SIZE 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.
* Code: LMK_KILL_OCCURRED = 51
@ -137,11 +122,6 @@ const char* stats_get_task_name(int pid);
#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
lmkd_pack_set_kill_occurred(LMK_KILL_OCCURRED_PACKET packet __unused,
struct kill_stat *kill_st __unused,