<feed xmlns='http://www.w3.org/2005/Atom'>
<title>system_core/lmkd, branch replicant-10</title>
<subtitle>Fork of system/core
</subtitle>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant-next/system_core/'/>
<entry>
<title>lmkd: Prevent non-main threads being registered or killed by lmkd</title>
<updated>2019-07-12T15:12:16+00:00</updated>
<author>
<name>Suren Baghdasaryan</name>
<email>surenb@google.com</email>
</author>
<published>2019-07-02T22:52:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant-next/system_core/commit/?id=c68cf6fe656d4f6e82d7831ae0615f8d2a883eac'/>
<id>c68cf6fe656d4f6e82d7831ae0615f8d2a883eac</id>
<content type='text'>
Only thread group leaders should be registered with lmkd. Add a check to
ignore any non-leader TIDs and generate an error if such condition is
detected. Run the same check before killing a process to detect cases of
non-leader TIDs being used to kill a process. This might happen if PIDs
overflow and previously registered PID gets reused for a non-leader
thread in the following scenario:

1. pid X is a thread group leader and is registered with lmkd
2. pid X dies without lmkd knowing it and pid gets recycled
3. process Y creates a thread with tid X
4. lmkd kills pid X which results in process Y being killed

Bug: 136408020
Test: lmkd_unit_test
Change-Id: I46c5a0b273f2b72cefc20ec59b80b4393f2a1a37
Signed-off-by: Suren Baghdasaryan &lt;surenb@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Only thread group leaders should be registered with lmkd. Add a check to
ignore any non-leader TIDs and generate an error if such condition is
detected. Run the same check before killing a process to detect cases of
non-leader TIDs being used to kill a process. This might happen if PIDs
overflow and previously registered PID gets reused for a non-leader
thread in the following scenario:

1. pid X is a thread group leader and is registered with lmkd
2. pid X dies without lmkd knowing it and pid gets recycled
3. process Y creates a thread with tid X
4. lmkd kills pid X which results in process Y being killed

Bug: 136408020
Test: lmkd_unit_test
Change-Id: I46c5a0b273f2b72cefc20ec59b80b4393f2a1a37
Signed-off-by: Suren Baghdasaryan &lt;surenb@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>lmkd: use ALOGE for logging kills</title>
<updated>2019-05-30T22:10:36+00:00</updated>
<author>
<name>Tim Murray</name>
<email>timmurray@google.com</email>
</author>
<published>2019-05-28T19:15:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant-next/system_core/commit/?id=b62b3ef2ba049e20af632aa5a99bdf60b3b13f3b'/>
<id>b62b3ef2ba049e20af632aa5a99bdf60b3b13f3b</id>
<content type='text'>
Test: boots, works
Bug: 133761317
Signed-off-by: Tim Murray &lt;timmurray@google.com&gt;
Exempt-From-Owner-Approval: trivial change

Change-Id: I1a4a3741694078eec124f1f560ea68e78754bca6
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Test: boots, works
Bug: 133761317
Signed-off-by: Tim Murray &lt;timmurray@google.com&gt;
Exempt-From-Owner-Approval: trivial change

Change-Id: I1a4a3741694078eec124f1f560ea68e78754bca6
</pre>
</div>
</content>
</entry>
<entry>
<title>lmkd: set PSI_POLL_PERIOD to 10ms</title>
<updated>2019-03-27T02:10:10+00:00</updated>
<author>
<name>Suren Baghdasaryan</name>
<email>surenb@google.com</email>
</author>
<published>2019-03-26T20:21:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant-next/system_core/commit/?id=5db6a84831ce97b4b862ffa10f964d4bea6089c2'/>
<id>5db6a84831ce97b4b862ffa10f964d4bea6089c2</id>
<content type='text'>
Occasionally we see cases when 40ms polling is still too conservative.
Change to 10ms polling period. Since the polling happens only after PSI
signal and continues for 1sec this should not affect system performance.

Test: lmkd_unit_test
Bug: 129358844

Change-Id: Ib759b865b2104be23741fc0eacaa541e22d50dde
Signed-off-by: Suren Baghdasaryan &lt;surenb@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Occasionally we see cases when 40ms polling is still too conservative.
Change to 10ms polling period. Since the polling happens only after PSI
signal and continues for 1sec this should not affect system performance.

Test: lmkd_unit_test
Bug: 129358844

Change-Id: Ib759b865b2104be23741fc0eacaa541e22d50dde
Signed-off-by: Suren Baghdasaryan &lt;surenb@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>lmkd: Fix meminfo logs missing SwapTotal and having wrong field order</title>
<updated>2019-03-25T18:04:11+00:00</updated>
<author>
<name>Suren Baghdasaryan</name>
<email>surenb@google.com</email>
</author>
<published>2019-03-25T18:01:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant-next/system_core/commit/?id=5ce165ec2e7b9723bdad79ddbc4b6e1b3037a1a7'/>
<id>5ce165ec2e7b9723bdad79ddbc4b6e1b3037a1a7</id>
<content type='text'>
Previous change If154dc364711bf7c86f32e24ddcd10be359386de called
"lmkd: Do not downgrade/ignore events when swap is full" added SwapTotal
into meminfo structure without adding the field into events.logtag file.
This results in logs which missing field and all fields starting with
"SwapFree" get reordered as a result. Fix this by adding the missing field
into events.logtag.

Bug: 129274901
Test: Confirm correct information in the logcat
Change-Id: Ia4de3790a7e9d49a0e4cba8b3161a715eaf6532e
Signed-off-by: Suren Baghdasaryan &lt;surenb@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previous change If154dc364711bf7c86f32e24ddcd10be359386de called
"lmkd: Do not downgrade/ignore events when swap is full" added SwapTotal
into meminfo structure without adding the field into events.logtag file.
This results in logs which missing field and all fields starting with
"SwapFree" get reordered as a result. Fix this by adding the missing field
into events.logtag.

Bug: 129274901
Test: Confirm correct information in the logcat
Change-Id: Ia4de3790a7e9d49a0e4cba8b3161a715eaf6532e
Signed-off-by: Suren Baghdasaryan &lt;surenb@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>lmkd: set PSI_POLL_PERIOD to 40ms</title>
<updated>2019-03-13T17:13:19+00:00</updated>
<author>
<name>Tim Murray</name>
<email>timmurray@google.com</email>
</author>
<published>2019-03-13T16:44:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant-next/system_core/commit/?id=0e5c00f375af87bbaf169be087d7b19d41b3f9cf'/>
<id>0e5c00f375af87bbaf169be087d7b19d41b3f9cf</id>
<content type='text'>
200ms was too lenient when under severe memory pressure.

Test: boots, works
Bug: 127765309

Change-Id: I8e047de6318574a107720c56473ed0f25582e182
Signed-off-by: Tim Murray &lt;timmurray@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
200ms was too lenient when under severe memory pressure.

Test: boots, works
Bug: 127765309

Change-Id: I8e047de6318574a107720c56473ed0f25582e182
Signed-off-by: Tim Murray &lt;timmurray@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Add min_score_adj into LmkKillOccurred event</title>
<updated>2019-03-05T09:51:06+00:00</updated>
<author>
<name>Suren Baghdasaryan</name>
<email>surenb@google.com</email>
</author>
<published>2019-03-04T19:07:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant-next/system_core/commit/?id=ec5e4c6eb1a85a11ec686dd6424a96e43d0555a1'/>
<id>ec5e4c6eb1a85a11ec686dd6424a96e43d0555a1</id>
<content type='text'>
Log min_score_adj when lmkd kills a process to determine the oom_score
levels that lmkd considers during the kill.

Bug: 123024834
Change-Id: I986ae8f2808199b1654bc8d2a32dd88046c79aa3
Signed-off-by: Suren Baghdasaryan &lt;surenb@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Log min_score_adj when lmkd kills a process to determine the oom_score
levels that lmkd considers during the kill.

Bug: 123024834
Change-Id: I986ae8f2808199b1654bc8d2a32dd88046c79aa3
Signed-off-by: Suren Baghdasaryan &lt;surenb@google.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>lmkd: Remove redundant free swap and free memory check</title>
<updated>2019-02-19T17:04:07+00:00</updated>
<author>
<name>Juju Sung</name>
<email>juju.sung@mediatek.com</email>
</author>
<published>2019-02-19T16:41:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant-next/system_core/commit/?id=1d982ded6f731d60416dd3b75928cb951ae5f9b3'/>
<id>1d982ded6f731d60416dd3b75928cb951ae5f9b3</id>
<content type='text'>
lmkd can't kill processes because it has compare the size between free swap and free memory. Free swap is often larger than the free memory when system is under low memory with less swap-backed or swappable pages and finally leads to I/O thrashing.

Test: TreeHugger
Bug: 124727769
Change-Id: Ia2848859aa97a24bd13c704acee4b86cd2d3f647
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
lmkd can't kill processes because it has compare the size between free swap and free memory. Free swap is often larger than the free memory when system is under low memory with less swap-backed or swappable pages and finally leads to I/O thrashing.

Test: TreeHugger
Bug: 124727769
Change-Id: Ia2848859aa97a24bd13c704acee4b86cd2d3f647
</pre>
</div>
</content>
</entry>
<entry>
<title>Make inlines static</title>
<updated>2019-02-06T23:19:00+00:00</updated>
<author>
<name>Pirama Arumuga Nainar</name>
<email>pirama@google.com</email>
</author>
<published>2019-02-06T23:16:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant-next/system_core/commit/?id=425e238ee0dd48d064c9055334b5e89e8a920c6d'/>
<id>425e238ee0dd48d064c9055334b5e89e8a920c6d</id>
<content type='text'>
Bug: http://b/116873221

If not, building with coverage (and -O0) is broken since Clang does not
inline these functions, and does not emit a definition because they are
not static or extern.

Test: Build with coverage (-O0)

Change-Id: I2880119834f764164a1aac10b696e76a2b462b71
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Bug: http://b/116873221

If not, building with coverage (and -O0) is broken since Clang does not
inline these functions, and does not emit a definition because they are
not static or extern.

Test: Build with coverage (-O0)

Change-Id: I2880119834f764164a1aac10b696e76a2b462b71
</pre>
</div>
</content>
</entry>
<entry>
<title>lmdk: Remove redundant 'if' check</title>
<updated>2019-02-04T16:50:10+00:00</updated>
<author>
<name>Greg Kaiser</name>
<email>gkaiser@google.com</email>
</author>
<published>2019-02-04T16:50:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant-next/system_core/commit/?id=a523fd6035bfa6d1c94dc730507286f9d92012b8'/>
<id>a523fd6035bfa6d1c94dc730507286f9d92012b8</id>
<content type='text'>
We already know that "polling" must be non-zero at this point,
because it hasn't been modified since our check on line 1960.
So we remove this check for code clarity.

Test: TreeHugger
Change-Id: I069d9fd0eef70748a5333733dd0518d1ac8021b7
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We already know that "polling" must be non-zero at this point,
because it hasn't been modified since our check on line 1960.
So we remove this check for code clarity.

Test: TreeHugger
Change-Id: I069d9fd0eef70748a5333733dd0518d1ac8021b7
</pre>
</div>
</content>
</entry>
<entry>
<title>lmkd: Add support for psi monitors</title>
<updated>2019-02-01T18:40:32+00:00</updated>
<author>
<name>Suren Baghdasaryan</name>
<email>surenb@google.com</email>
</author>
<published>2019-01-08T20:54:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.replicant.us/replicant-next/system_core/commit/?id=77122e57807f20b39aa9b0d8e82d31c79d35a2da'/>
<id>77122e57807f20b39aa9b0d8e82d31c79d35a2da</id>
<content type='text'>
With new psi monitor support in the kernel lmkd can use it to register
custom pressure levels. Add lmkd support for psi monitors when they are
provided by the kernel and use them by default. When kernel does not
support psi lmkd will fall back to vmpressure usage.
Add ability to poll memory status after the initial psi event is triggered
because kernel throttles psi memory pressure events to one per PSI tracking
window (currently set to 1sec). Current implementation polls every 200ms
for 1sec duration after the initial event is triggered.
If ro.lmk.use_psi is set to false psi logic will be disabled even when psi
is supported in kernel.

Bug: 111308141
Test: lmkd_unit_test
Change-Id: I685774b176f393bab7412161773f5c9af51e0163
Signed-off-by: Suren Baghdasaryan &lt;surenb@google.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
With new psi monitor support in the kernel lmkd can use it to register
custom pressure levels. Add lmkd support for psi monitors when they are
provided by the kernel and use them by default. When kernel does not
support psi lmkd will fall back to vmpressure usage.
Add ability to poll memory status after the initial psi event is triggered
because kernel throttles psi memory pressure events to one per PSI tracking
window (currently set to 1sec). Current implementation polls every 200ms
for 1sec duration after the initial event is triggered.
If ro.lmk.use_psi is set to false psi logic will be disabled even when psi
is supported in kernel.

Bug: 111308141
Test: lmkd_unit_test
Change-Id: I685774b176f393bab7412161773f5c9af51e0163
Signed-off-by: Suren Baghdasaryan &lt;surenb@google.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
