I found a way to log oom kills by watching dmesg while browsing a heavy web site using the Browser:
dmesg -w | egrep "lowmemorykiller|oom_reaper|^ {19}.*"
Using that I get output like this:
[140539.580703] lowmemorykiller: Killing 'ec_fdroid:tab21' (22126), adj 905,
to free 85860kB on behalf of 'HwBinder:3801_1' (23173) because
cache 475268kB is below limit 668640kB for oom_score_adj 0
Free memory is 647552kB above reserved.
Free CMA is 0kB
Total reserve is 136256kB
Total free pages is 71000kB
Total file cache is 553396kB
Slab Reclaimable is 123100kB
Slab UnReclaimable is 417072kB
Total Slab is 540172kB
GFP mask is 0x6280c2
Kernel Memory Reclaimable is 13556kB
Free Swap 699252kB
queue len is 1 of max 1 reason:0x2 margin:-16314
[140539.581611] lowmemorykiller: Killing 'AndroidUI' (22051), adj 900,
to free 148920kB on behalf of 'HwBinder:3801_1' (23173) because
cache 475268kB is below limit 668640kB for oom_score_adj 0
Free memory is 647552kB above reserved.
Free CMA is 0kB
Total reserve is 136256kB
Total free pages is 71000kB
Total file cache is 553396kB
Slab Reclaimable is 123100kB
Slab UnReclaimable is 417072kB
Total Slab is 540172kB
GFP mask is 0x6280c2
Kernel Memory Reclaimable is 13556kB
Free Swap 699252kB
queue len is 1 of max 1 reason:0x2 margin:-16314
[140539.587560] lowmemorykiller: Killing 'com.whatsapp' (23989), adj 104,
to free 78024kB on behalf of 'HwBinder:3801_1' (23173) because
cache 474812kB is below limit 668640kB for oom_score_adj 0
Free memory is 656144kB above reserved.
Free CMA is 0kB
Total reserve is 136256kB
Total free pages is 80104kB
Total file cache is 552940kB
Slab Reclaimable is 123100kB
Slab UnReclaimable is 417072kB
Total Slab is 540172kB
GFP mask is 0x6280c2
Kernel Memory Reclaimable is 13556kB
Free Swap 698740kB
queue len is 1 of max 1 reason:0x2 margin:-14038
[140539.591645] lowmemorykiller: Killing 'jolla-email' (31314), adj 103,
to free 137720kB on behalf of 'lipstick' (5980) because
cache 474132kB is below limit 668640kB for oom_score_adj 0
Free memory is 658960kB above reserved.
Free CMA is 0kB
Total reserve is 136256kB
Total free pages is 83632kB
Total file cache is 552256kB
Slab Reclaimable is 123100kB
Slab UnReclaimable is 417072kB
Total Slab is 540172kB
GFP mask is 0x6000c0
Kernel Memory Reclaimable is 13100kB
Free Swap 698484kB
queue len is 1 of max 1 reason:0x2 margin:-13156
[140539.594922] oom_reaper: reaped process 22126 (ec_fdroid:tab21), now anon-rss:0kB, file-rss:0kB, shmem-rss:24kB
[140539.623615] oom_reaper: reaped process 31314 (jolla-email), now anon-rss:0kB, file-rss:0kB, shmem-rss:84kB
[140539.646406] oom_reaper: reaped process 23989 (com.whatsapp), now anon-rss:0kB, file-rss:0kB, shmem-rss:2780kB
[140539.681563] oom_reaper: reaped process 22051 (AndroidUI), now anon-rss:0kB, file-rss:128kB, shmem-rss:760kB
The good thing is that I can now see every OOM kill. The bad thing is that it’s very frequent… It’s a few kills per minute, give or take.
Edit: This is pretty much offtopic, so I started a new thread instead.