Commit Graph

16 Commits

Author SHA1 Message Date
Suren Baghdasaryan 2300230ea4 lmkd/tests: handle the case when process exits before reaping starts
Current test will fail in the case when the target process exits before
process_mrelease is called. However this is possible and should not be
treated as an invalid case. Add special handling of this case in the
test.

Bug: 254880957
Test: run lmkd_tests until this case happens
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Ica5b28fa52a5f42a771fb9516112e58b66291068
Merged-In: Ica5b28fa52a5f42a771fb9516112e58b66291068
2022-10-26 23:55:56 +00:00
Bart Van Assche 911f106a4a liblmkd_utils: Use libprocessgroup to create cgroups
Bug: 213617178
Test: Ran lmkd_tests inside Cuttlefish
Change-Id: Ic34b731dfe5d6b1e90d258c2b0af538a216b054a
Signed-off-by: Bart Van Assche <bvanassche@google.com>
2022-03-21 15:57:37 -07:00
Suren Baghdasaryan 2bf5487381 lmkd/tests: Consume memory more aggressively to avoid test timeout
Increase the allocation step to 5MB and decrease the delay between
allocations to 200ms in order to speed up memory consumption and
avoid the test timing out.

Bug: 217478668
Test: atest lmkd_tests:lmkd_tests.LmkdTest#TargetReaping -- --abi x86_64
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Ia36229b280d79acd9d93a5ca1961d6cf1ef223df
2022-02-03 14:53:00 -08:00
Suren Baghdasaryan c58acac201 lmkd/tests: Move tests into presubmit-large category to avoid timeouts
Since lmkd tests require time to build up memory pressure, they cause
timeouts when run as part of presubmits. Move them into the
presubmit-large category with higher timeout to prevent such failures.

Bug: 217478668
Bug: 203597692
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I690133c9f849da58b85884a7d7b463f5b518c12f
2022-02-02 09:27:47 -08:00
Suren Baghdasaryan 683d6cbc2d lmkd/tests: Add a test to check for lmkd process reaping capability
Add a test to verify a process killed by lmkd is being reaped when
kernel supports process_mrelease syscall.

Bug: 203597692
Test: atest LmkdTest
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: Iac46f68c811e6e89378952ce1d29daf8a47514e2
2022-02-01 11:40:47 -08:00
Bob Badour 0bc044bc32 [LSC] Add LOCAL_LICENSE_KINDS to system/memory/lmkd
Added SPDX-license-identifier-Apache-2.0 to:
  Android.bp
  libpsi/Android.bp
  tests/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I5fed190764c763388c50c2fea58c5c421579bd30
2021-02-12 18:10:32 -08:00
Suren Baghdasaryan d7146e0f54 lmkd_test: remove memcg creation on non-AndroidGo devices
Memory cgroups are disabled on non-AndroidGo devices. Change the test
not to fail due to missing in-kernel memory cgroup support.

Bug: 172296409
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I35d724c23c22e97458976c1cad45fe9d993326f9
2021-01-21 22:37:03 +00:00
Martin Liu fce58e9165 lmkd_test: set process types
We introduced supporting process type while
registering a process in lmkd. Thus we need
to set process type when registering the test
unit or lmkd would not be able to kill it.

Bug: 143857475
Test: Verified using lmkd_unit_test
Change-Id: I7bf2b552c242dbdc13bb431248ec9182dccaa599
2020-03-09 13:17:51 +08:00
Martin Liu f2ead0ca1a lmkd_test: align proc_name with lmkd
This change is to align how we get proc_name
between lmkd and lmkd_unit_test or it will always
fail when we run command such as ./lmkd_unit_test
under the device shell.

Bug: 146415484
Test: Verified using lmkd_unit_test
Change-Id: I3a6ebf0747a1054c5758b91fbacf3179b66b56c3
2019-12-20 11:12:06 +08:00
Tom Cherry 4a28d2a270 lmkd: add missing libcutils library to test
lmkd's test depends on the socket_local_client() function from
libcutils, but since liblog also exposes this symbol weakly, that is
the symbol that gets used instead of the intended libcutil's copy of
the symbol.

Test: build
Change-Id: I294fa157a7f50881bf6360922419976eb1ee3ac7
2019-01-15 14:14:20 -08:00
Suren Baghdasaryan 53be36e6d8 lmkd: rate-limit and cleanup failed kill reports
Excessive number of failed kill reports when lmkd can't find an eligible
process to kill or frees not enough memory pollutes logs and bugreports.
Cleanup kill reports to remove duplicate information and rate limit failed
kill attempts at 1 report per sec. The number of suppressed failed kills
will be reported in the next lmkd report.

Bug: 113864581
Test: Verified using lmkd_unit_test
Change-Id: I67fa1fec97613f136c7582115edcbc56b1503c9c
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-09-06 01:59:49 +00:00
Mark Salyzyn ef4b4be3a5 Merge "lmkd: test: access /sys/module/lowmemorykiller/ as u:r:shell:s0" am: b69cb7071d
am: 4f7d8851a5

Change-Id: I1ef7aab68bfb5a11891ef4777f6dc46774120a21
2018-04-05 19:45:16 -07:00
Mark Salyzyn 930f877944 lmkd: test: access /sys/module/lowmemorykiller/ as u:r:shell:s0
lmkd_unit_test gets an selinux violation when run unprivileged:

lmkd_unit_test: type=1400 audit(0.0:???): avc: denied { search } for
    name="lowmemorykiller" dev="sysfs" ino=??? scontext=u:r:shell:s0
    tcontext=u:object_r:sysfs_lowmemorykiller:s0 tclass=dir
    permissive=0

resulting in log noise.  Check for INKERNEL_MINFREE_PATH existence
after known to be escalated as root user to suppress noise.

Test: lmkd_unit_test as unprivileged user, there should be no audits.
Change-Id: Ia5c7824e7070c98ee6eea20ca53097e4e56d61b6
2018-04-03 14:41:11 +00:00
Suren Baghdasaryan 58dfc89613 lmkd: Fix lmkd-test to work with relative paths
This change allows lmkd-test to work correctly when it's started
using absolute as well as relative path.

Change-Id: Ida58d13d66a224119a363f59cc59289f0167d3c9
2018-03-13 12:34:18 -07:00
Suren Baghdasaryan 40b694d5df lmkd: Implement lmkd-test
(cherry pick from commit 5f5b30e58ba8964f78231ebf96e4ec80e7a31ecd)

lmkd-test executes alloc-stress native application and monitors kernel
logs for OOM kills.

Bug: 63631020

Change-Id: Ia9441cc5f8e283131f0bc839cb808a911bcdb168
Merged-In: Ia9441cc5f8e283131f0bc839cb808a911bcdb168
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-03-09 11:19:24 -08:00
Suren Baghdasaryan 3f82af9977 lmkd: Implement lmkd-test
lmkd-test executes alloc-stress native application and monitors kernel
logs for OOM kills.

Bug: 63631020

Change-Id: Ia9441cc5f8e283131f0bc839cb808a911bcdb168
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2018-01-31 18:11:38 +00:00