OSDN Git Service

ANDROID: Communicates LMK events to userland where they can be logged
authorJim Blackler <jimblackler@google.com>
Fri, 5 Apr 2019 15:25:04 +0000 (16:25 +0100)
committerJim Blackler <jimblackler@google.com>
Wed, 1 May 2019 13:31:50 +0000 (13:31 +0000)
commit152bacdd85c46f0c76b00c4acc253e414513634c
treecef12be7301064cef8b40914e183786dd6a88148
parentaab9adb4b81bcce107dd1783f6ac41dc1abe9f15
ANDROID: Communicates LMK events to userland where they can be logged

Makes a file /proc/lowmemorykiller available for polling by user space.
Immediately as a process is killed by lowmemorykiller information about
that process is pushed to the file. It contains information about the
process at the time it was killed, to be gathered as metrics.

The file is expected to be continuously read from. To prevent failure
to do so from causing memory to be continuously consumed, after eight
processes have been killed, no more events will be logged until the
file is read from again.

The format is integers separated by spaces:
Field 0    pid
The identifier of the process.
Field 1    uid
The UNIX ID of the user the process was running under.
Field 2    group_leader_pid
The group leader of the process.
Field 3    min_flt
The number of minor page faults.
Field 4    maj_flt
The number of minor page faults.
Field 5    rss_in_pages
The Resident Set Size in pages.
Field 6    oom_score_adj
The adjusted Out Of Memory score.
Field 7    start_time
The number of nanoseconds that the process ran for.

--New line--
Field 8    taskname
The cmd line used to launch the process, truncated to 127 characters,
and terminated by a new line.

Bug: 130017100
Test: Tested manually
Change-Id: I461b191eda9e578b9d2c2d1843b1b81948353a95
Signed-off-by: Jim Blackler <jimblackler@google.com>
drivers/staging/android/lowmemorykiller.c