Nice analysis. Idea 1 you might be onto something. Maybe NuWa rebalanced our 
memory equation here? I don't know this part of the code particularly well. 
Paging Kyle and Nick who might know more. This code is a bit under-owned for 
the last months, so if you find someone suspicious, chances are, its broken.

As for your question, when the low-memory notification arrives we send a 
Gecko-level notification around that flushes caches (gfx caches, code caches, 
etc). We also flush caches when we background an application (read: page) and 
an event is delivered to the application to indicate that its no longer 
visible. The page is supposed to save all its state at that point, so I guess 
there isn't much need to explicitly exit. If the OOM condition gets worse the 
background processes will get reaped, which is not a bad thing, and suiciding 
them early probably doesn't benefit us much. I might be wrong. Again, I don't 
know this code very well, except that its super finicky and it was a pain to 
tune this.

Andreas

On Nov 15, 2013, at 7:27 AM, [email protected] wrote:

> A pair of wild ideas from a barely initiated n00b.  I apologize if I don't 
> have proper context or these ideas are naive.  Whatever the case, I'm sure it 
> will be educational for me.
> 
> Idea 1: as I crawl around on my ZTE open I see some suspicious configuration:
> 
> first, in /sys/module/lowmemorykiller/parameters/minfree
> 
> 1024,1280,1536,1792,2048,5120
> 
> next, in /sys/module/lowmemorykiller/parameters/notify_trigger
> 
> 3584
> 
> The question: Why are we notifying of memory pressure when we get down 14mb 
> but killing off application level (adj >= 10) processes, before that, at 20mb?
> 
> The idea: Is lowmemorykilling for adj >= 10 down at 10mb undesirable for some 
> reason?  would these be better parameters which allow us to delay killing 
> processes until we've had a chance to respond to the low memory event that 
> raises up via GonkMemoryPressureMonitoring.cpp?
> 
> Here's what my b2g-info output looks like with updated parameters and Nuwa 
> enabled:  https://gist.github.com/lloyd/7467857
> 
> Note line 35.  (also, this is awesome!)
> 
> Testing the device I find I'm able to run an additional app in that 10mb, and 
> I feel like behavior under memory pressure is without regression.
> 
> Idea 2: I'm having a hard time tracing what lowmemorykiller notifications 
> trigger.  Is this documented anywhere?
> 
> It would seem with a notification up a little higher (perhaps at 20meg where 
> the killing happens today) we could deliver a message to non-foreground 
> applications that could choose to ignore it, or choose to shut themselves 
> down cleanly and dodge the reaper.
> 
> So the idea is, should we consider application level events when we detect 
> impending memory pressure?
> 
> thanks for listening!
> lloyd
> 
> 
> _______________________________________________
> dev-b2g mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-b2g

_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to