Closed Bug 913893 Opened 8 years ago Closed 3 years ago

Kill least recently used background apps instead of random killing for OOM and LMK.

Categories

(Firefox OS Graveyard :: General, defect)

All
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: sinker, Unassigned)

References

Details

Classify normal content processes; not homescreen or other special cases, to levels of OOM priority.  The least recently used App will be killed first before others for OOM or LMK.  The processes are prioritized according time to last activities of input events, inter-app communication, or becoming background.

This may also fix some potential bugs of interaction between Apps; likes bug 892371.
To elaborate, we may monitor IPC activities as the indicator to recency. The most recently used app is the app that the chrome process recently sends messages to or receives messages from.

The issues with this approach is that we need check what messages are used as the recency indicator. Taking each IPC message into account will incur too much overhead as we will adjust the OOM score too often. A solution is using a whitelist of message Ids and only making OOM adjustment on messages in the whitelist.
Hi Thinker,

Is bug 822325, which is waiting for review, part of this?
Currently updating the LRU app cache on frame visibility change works pretty well, but in the future the definition of recency will change. Bug 876397 (inter-app communications) is an example that an app can receive messages in the background.

I think we can make bug 822325 land first and make other cases as followups.
Depends on: 822325
Is there anything left to do here now that bug 822325 is fixed?
Flags: needinfo?(cyu)
This bug is here for tracking.  We will look back this bug later if bug 963477 don't fix the problem.
By the way, bug 822325 don't fix the bug here.
Depends on: 963477
I am a little confused here. This bug is opened originally for differentiating background apps so when the lowmemory killer wakes up, it doesn't choose one from several background app randomly because the background apps all look the same to the lowmemory killer.

The goal is to differentiate/prioritize background apps so the least recently used app is chosen first by the lowmemory killer. We can differentiate background apps by:

1. When the app is launched.
2. Inter-app communications.
3. Other indicators.

Bug 822325 resolves 1. It should improve the situation. I am not sure if 2. really causes problems (in theory it does, but actually?). I don't think we depend this bug on bug 963477.
Flags: needinfo?(cyu)
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.