lmkd: Ensure node stats are being parsed
The kernel will print node stats within the first populated zone in the zoneinfo file. The LMKD tries parsing node stats when it reads the first "Node %d, zone %8s" line in zoneinfo. However if the first zone is empty, LMKD could iterate over to the next populated zone i.e. the next "Node %d, zone %8s" line while attempting to read node stats. It thus reads the incorrect zone name for this next zone. To fix this, ensure whether node stats are indeed being parsed by checking for the " per node-stats" line. Bug: 292476676 Change-Id: I72cd111dac9032de506e1ab7f1c4dc96585a1e80 Signed-off-by: Jaskaran Singh <quic_jasksing@quicinc.com>
This commit is contained in:
parent
667fdbfe92
commit
f32fe4d7d3
10
lmkd.cpp
10
lmkd.cpp
|
|
@ -94,6 +94,7 @@ static inline void trace_kill_end() {}
|
|||
#define PROC_STATUS_TGID_FIELD "Tgid:"
|
||||
#define PROC_STATUS_RSS_FIELD "VmRSS:"
|
||||
#define PROC_STATUS_SWAP_FIELD "VmSwap:"
|
||||
#define NODE_STATS_MARKER " per-node stats"
|
||||
|
||||
#define PERCEPTIBLE_APP_ADJ 200
|
||||
#define PREVIOUS_APP_ADJ 700
|
||||
|
|
@ -1859,6 +1860,15 @@ static int zoneinfo_parse(struct zoneinfo *zi) {
|
|||
int node_id;
|
||||
if (sscanf(line, "Node %d, zone %" STRINGIFY(LINE_MAX) "s", &node_id, zone_name) == 2) {
|
||||
if (!node || node->id != node_id) {
|
||||
line = strtok_r(NULL, "\n", &save_ptr);
|
||||
if (strncmp(line, NODE_STATS_MARKER, strlen(NODE_STATS_MARKER)) != 0) {
|
||||
/*
|
||||
* per-node stats are only present in the first non-empty zone of
|
||||
* the node.
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
|
||||
/* new node is found */
|
||||
if (node) {
|
||||
node->zone_count = zone_idx + 1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue