Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Issue 3235007: This adds periodic OOM score adjustment, based on the last access time (Closed)

Created:
10 years, 3 months ago by Greg Spencer (Chromium)
Modified:
9 years, 6 months ago
Reviewers:
agl
CC:
chromium-reviews, ben+cc_chromium.org, agl, brettw-cc_chromium.org
Visibility:
Public.

Description

This adds periodic OOM score adjustment, based on the last access time of the tab, whether or not it is pinned, and (of course) how much memory it is using. TEST=Tested on dogfood machine, both using large numbers of tabs, and small tabs that used lots of memory. BUG=none

Patch Set 1 #

Patch Set 2 : Fixing compile on linux #

Total comments: 37

Patch Set 3 : Response to first review comments. #

Patch Set 4 : Final review changes #

Unified diffs Side-by-side diffs Delta from patch set Stats (+259 lines, -12 lines) Patch
M base/task.h View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/browser_main.cc View 1 2 3 3 chunks +15 lines, -3 lines 0 comments Download
A chrome/browser/oom_priority_manager.h View 1 2 1 chunk +48 lines, -0 lines 0 comments Download
A chrome/browser/oom_priority_manager.cc View 1 2 3 1 chunk +169 lines, -0 lines 0 comments Download
M chrome/browser/tab_contents/tab_contents.h View 1 2 2 chunks +6 lines, -0 lines 0 comments Download
M chrome/browser/tab_contents/tab_contents.cc View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/zygote_host_linux.h View 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/browser/zygote_host_linux.cc View 2 chunks +11 lines, -8 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 2 chunks +5 lines, -0 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
Greg Spencer (Chromium)
10 years, 3 months ago (2010-08-31 17:19:21 UTC) #1
Greg Spencer (Chromium)
http://codereview.chromium.org/3235007/diff/2001/3002 File chrome/browser/browser_main.cc (right): http://codereview.chromium.org/3235007/diff/2001/3002#newcode1417 chrome/browser/browser_main.cc:1417: browser::OomPriorityManager oom_priority_manager; On 2010/08/31 18:00:03, agl wrote: > See ...
10 years, 3 months ago (2010-08-31 21:36:57 UTC) #2
agl
LGTM http://codereview.chromium.org/3235007/diff/2001/3002 File chrome/browser/browser_main.cc (right): http://codereview.chromium.org/3235007/diff/2001/3002#newcode1417 chrome/browser/browser_main.cc:1417: browser::OomPriorityManager oom_priority_manager; On 2010/08/31 21:36:57, Greg Spencer (Chromium) ...
10 years, 3 months ago (2010-09-01 14:18:07 UTC) #3
Greg Spencer (Chromium)
10 years, 3 months ago (2010-09-02 19:32:41 UTC) #4
http://codereview.chromium.org/3235007/diff/2001/3003
File chrome/browser/oom_priority_manager.cc (right):

http://codereview.chromium.org/3235007/diff/2001/3003#newcode95
chrome/browser/oom_priority_manager.cc:95: BrowserList::const_iterator
browser_iterator = BrowserList::begin();
On 2010/09/01 14:18:07, agl wrote:
> On 2010/08/31 21:36:57, Greg Spencer (Chromium) wrote:
> > Done.  Can you explain to me why this is the case?
> 
> Although using /proc should be fast (you would think), it can still be stuck
> behind locks which bring it down to the speed of the root filesystem (because
> looking up /proc is a rootfs operation). In general, all disk access is
> forbidden on the main thread in order to avoid jankyness.

OK, that makes sense, thanks.

http://codereview.chromium.org/3235007/diff/2001/3003#newcode96
chrome/browser/oom_priority_manager.cc:96: while (browser_iterator !=
BrowserList::end()) {
On 2010/09/01 14:18:07, agl wrote:
> On 2010/08/31 21:36:57, Greg Spencer (Chromium) wrote:
> > Done.
> 
> (Not in the code that you uploaded, but I'll take your word.)

Whoops.  It'll be in the submission.

http://codereview.chromium.org/3235007/diff/2001/3003#newcode106
chrome/browser/oom_priority_manager.cc:106: scoped_ptr<ProcessMetrics> metrics(
On 2010/09/01 14:18:07, agl wrote:
> On 2010/08/31 21:36:57, Greg Spencer (Chromium) wrote:
> > OK, so this is the exact algorithm that the task manager uses for "Physical
> > Memory".  Do you think proportional would work better as an estimate for
which
> > process is hogging the most and hence should be killed first?
> 
> I think you might be looking at Windows specific code in that case. PSS is the
> value that you want and, according to the comments, it's in the 'shared'
member.

Actually, it's not in Windows specific code: it's in task_manager.cc, and not
wrapped by any OS_ macros, and appears to be compiled into linux as well.

In any case, I switched to just using the PSS instead of the physical memory
algorithm, since I don't actually think it matters much -- we really just want a
relative badness score for the tabs, and either one gives us some version of
that.

Powered by Google App Engine
This is Rietveld 408576698