{"action":"created","issue":{"url":"https://api.github.com/repos/rfjakob/earlyoom/issues/8","labels_url":"https://api.github.com/repos/rfjakob/earlyoom/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/rfjakob/earlyoom/issues/8/comments","events_url":"https://api.github.com/repos/rfjakob/earlyoom/issues/8/events","html_url":"https://github.com/rfjakob/earlyoom/issues/8","id":93504875,"number":8,"title":"Avoid killing my active Chrome tab","user":{"login":"joeytwiddle","id":911799,"avatar_url":"https://avatars.githubusercontent.com/u/911799?v=3","gravatar_id":"","url":"https://api.github.com/users/joeytwiddle","html_url":"https://github.com/joeytwiddle","followers_url":"https://api.github.com/users/joeytwiddle/followers","following_url":"https://api.github.com/users/joeytwiddle/following{/other_user}","gists_url":"https://api.github.com/users/joeytwiddle/gists{/gist_id}","starred_url":"https://api.github.com/users/joeytwiddle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joeytwiddle/subscriptions","organizations_url":"https://api.github.com/users/joeytwiddle/orgs","repos_url":"https://api.github.com/users/joeytwiddle/repos","events_url":"https://api.github.com/users/joeytwiddle/events{/privacy}","received_events_url":"https://api.github.com/users/joeytwiddle/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-07-07T11:03:53Z","updated_at":"2015-11-11T08:58:41Z","closed_at":null,"body":"I am a tab junkie.  (130 tabs currently open in Chrome, and sometimes I run Firefox alongside it.)\r\n\r\nI have started noticing a recurring issue than when my memory is nearly full and I open a heavy webpage, after a few seconds the tab I am working in gets killed!\r\n\r\nThe behaviour I would prefer is that the new tab would be left running, even though it is using a lot of memory, and an older tab/process would be killed.\r\n\r\n(Example \"heavy\" pages are [Google Maps](http://maps.google.com/), Facebook, and Google Drive spreadsheets.)\r\n\r\nSo I would like a process to have its badness reduced when it first starts, but this would gently slide back to the default over time.\r\n\r\nI wonder if the start time of a processes is available from `se.exec` in `/proc/*/sched_start`...  (Edit: No, I found what I needed in `.../stat`.)\r\n\r\nAdmittedly my proposed solution will NOT help if I was to switch to an old tab/app and cause it to start consuming a lot of memory. For that situation, it might be more appropriate track which process the user has been *recently interacting* with. But I fear that might not be easy to detect. A simpler alternative would be to reduce badness of *active processes*, hence favouring the destruction of processes that have been idle for some time."},"comment":{"url":"https://api.github.com/repos/rfjakob/earlyoom/issues/comments/155708419","html_url":"https://github.com/rfjakob/earlyoom/issues/8#issuecomment-155708419","issue_url":"https://api.github.com/repos/rfjakob/earlyoom/issues/8","id":155708419,"user":{"login":"joeytwiddle","id":911799,"avatar_url":"https://avatars.githubusercontent.com/u/911799?v=3","gravatar_id":"","url":"https://api.github.com/users/joeytwiddle","html_url":"https://github.com/joeytwiddle","followers_url":"https://api.github.com/users/joeytwiddle/followers","following_url":"https://api.github.com/users/joeytwiddle/following{/other_user}","gists_url":"https://api.github.com/users/joeytwiddle/gists{/gist_id}","starred_url":"https://api.github.com/users/joeytwiddle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joeytwiddle/subscriptions","organizations_url":"https://api.github.com/users/joeytwiddle/orgs","repos_url":"https://api.github.com/users/joeytwiddle/repos","events_url":"https://api.github.com/users/joeytwiddle/events{/privacy}","received_events_url":"https://api.github.com/users/joeytwiddle/received_events","type":"User","site_admin":false},"created_at":"2015-11-11T08:58:41Z","updated_at":"2015-11-11T08:58:41Z","body":"So, the main problem is that processes with high memory usage have a higher `oom_score`.\r\n\r\nBut frequently the active tab has high memory usage (because it's doing stuff, whereas idle tabs have likely been garbage reclaimed).\r\n\r\nI believe this was causing the active tab to be preferred for killing. That's the opposite of what I wanted! The memory score was often swamping the age score.\r\n\r\nSo I have attacked this by significantly reducing the `oom_score` (whilst still preserving `oom_score_adj`) in favour of process age (`time_running`).\r\n\r\nThis has resulted in a much more favourable experience. My active tab is still occasionally killed, but less often than before.\r\n\r\nFor anyone interested, significantly better behaviour started from commit https://github.com/joeytwiddle/earlyoom/commit/6e8e731ef47e2994b66546d69c148a3bda5f7992"}}