Re: [RFC] simple_lmk: Introduce Simple Low Memory Killer for Android
From: Greg Kroah-Hartman
Date: Sun Mar 10 2019 - 17:14:02 EST
On Sun, Mar 10, 2019 at 01:34:03PM -0700, Sultan Alsawaf wrote:
> From: Sultan Alsawaf <sultan@xxxxxxxxxxxxxxx>
>
> This is a complete low memory killer solution for Android that is small
> and simple. It kills the largest, least-important processes it can find
> whenever a page allocation has completely failed (right after direct
> reclaim). Processes are killed according to the priorities that Android
> gives them, so that the least important processes are always killed
> first. Killing larger processes is preferred in order to free the most
> memory possible in one go.
>
> Simple LMK is integrated deeply into the page allocator in order to
> catch exactly when a page allocation fails and exactly when a page is
> freed. Failed page allocations that have invoked Simple LMK are placed
> on a queue and wait for Simple LMK to satisfy them. When a page is about
> to be freed, the failed page allocations are given priority over normal
> page allocations by Simple LMK to see if they can immediately use the
> freed page.
>
> Additionally, processes are continuously killed by failed small-order
> page allocations until they are satisfied.
>
> Signed-off-by: Sultan Alsawaf <sultan@xxxxxxxxxxxxxxx>
Wait, why? We just removed the in-kernel android memory killer, we
don't want to add another one back again, right? Android Go devices
work just fine with the userspace memory killer code, and those are "low
memory" by design.
Why do we need kernel code here at all?
thanks,
greg k-h