stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, David Rientjes <rientjes@google.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH 3.13 064/120] mm, oom: base root bonus on current usage
Date: Tue, 11 Feb 2014 11:05:05 -0800	[thread overview]
Message-ID: <20140211184825.444456224@linuxfoundation.org> (raw)
In-Reply-To: <20140211184823.492407127@linuxfoundation.org>

3.13-stable review patch.  If anyone has any objections, please let me know.

------------------

From: David Rientjes <rientjes@google.com>

commit 778c14affaf94a9e4953179d3e13a544ccce7707 upstream.

A 3% of system memory bonus is sometimes too excessive in comparison to
other processes.

With commit a63d83f427fb ("oom: badness heuristic rewrite"), the OOM
killer tries to avoid killing privileged tasks by subtracting 3% of
overall memory (system or cgroup) from their per-task consumption.  But
as a result, all root tasks that consume less than 3% of overall memory
are considered equal, and so it only takes 33+ privileged tasks pushing
the system out of memory for the OOM killer to do something stupid and
kill dhclient or other root-owned processes.  For example, on a 32G
machine it can't tell the difference between the 1M agetty and the 10G
fork bomb member.

The changelog describes this 3% boost as the equivalent to the global
overcommit limit being 3% higher for privileged tasks, but this is not
the same as discounting 3% of overall memory from _every privileged task
individually_ during OOM selection.

Replace the 3% of system memory bonus with a 3% of current memory usage
bonus.

By giving root tasks a bonus that is proportional to their actual size,
they remain comparable even when relatively small.  In the example
above, the OOM killer will discount the 1M agetty's 256 badness points
down to 179, and the 10G fork bomb's 262144 points down to 183500 points
and make the right choice, instead of discounting both to 0 and killing
agetty because it's first in the task list.

Signed-off-by: David Rientjes <rientjes@google.com>
Reported-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 Documentation/filesystems/proc.txt |    4 ++--
 mm/oom_kill.c                      |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

--- a/Documentation/filesystems/proc.txt
+++ b/Documentation/filesystems/proc.txt
@@ -1377,8 +1377,8 @@ may allocate from based on an estimation
 For example, if a task is using all allowed memory, its badness score will be
 1000.  If it is using half of its allowed memory, its score will be 500.
 
-There is an additional factor included in the badness score: root
-processes are given 3% extra memory over other tasks.
+There is an additional factor included in the badness score: the current memory
+and swap usage is discounted by 3% for root processes.
 
 The amount of "allowed" memory depends on the context in which the oom killer
 was called.  If it is due to the memory assigned to the allocating task's cpuset
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -170,7 +170,7 @@ unsigned long oom_badness(struct task_st
 	 * implementation used by LSMs.
 	 */
 	if (has_capability_noaudit(p, CAP_SYS_ADMIN))
-		adj -= 30;
+		points -= (points * 3) / 100;
 
 	/* Normalize to oom_score_adj units */
 	adj *= totalpages / 1000;



  parent reply	other threads:[~2014-02-11 19:05 UTC|newest]

Thread overview: 126+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-11 19:04 [PATCH 3.13 000/120] 3.13.3-stable review Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 001/120] mei: mei_hbm_dispatch() returns void Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 002/120] SELinux: Fix memory leak upon loading policy Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 003/120] tracing: Have trace buffer point back to trace_array Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 004/120] tracing: Check if tracing is enabled in trace_puts() Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 005/120] arch/sh/kernel/kgdb.c: add missing #include <linux/sched.h> Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 006/120] intel-iommu: fix off-by-one in pagetable freeing Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 007/120] Revert "EISA: Initialize device before its resources" Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 008/120] fuse: fix pipe_buf_operations Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 009/120] audit: reset audit backlog wait time after error recovery Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 010/120] audit: correct a type mismatch in audit_syscall_exit() Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 011/120] xen/pvhvm: If xen_platform_pci=0 is set dont blow up (v4) Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 012/120] mm/memory-failure.c: shift page lock from head page to tail page after thp split Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 013/120] mm/memcg: iteration skip memcgs not yet fully initialized Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 014/120] mm/page-writeback.c: fix dirty_balance_reserve subtraction from dirtyable memory Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 015/120] mm/page-writeback.c: do not count anon pages as " Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 016/120] memcg: fix endless loop caused by mem_cgroup_iter Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 017/120] memcg: fix css reference leak and endless loop in mem_cgroup_iter Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 018/120] mm: ignore VM_SOFTDIRTY on VMA merging Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 019/120] mm: dont lose the SOFT_DIRTY flag on mprotect Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 020/120] mmc: fix host release issue after discard operation Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 021/120] mmc: atmel-mci: fix timeout errors in SDIO mode when using DMA Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 022/120] mmc: core: sd: implement proper support for sd3.0 au sizes Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 023/120] ARM: orion: provide C-style interrupt handler for MULTI_IRQ_HANDLER Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 024/120] ARM: mvebu: Fix kernel hang in mvebu_soc_id_init() when of_iomap failed Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 025/120] slub: Fix calculation of cpu slabs Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 026/120] turbostat: Dont put unprocessed uapi headers in the include path Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 028/120] ACPI / init: Flag use of ACPI and ACPI idioms for power supplies to regulator API Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 029/120] compat: fix sys_fanotify_mark Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 030/120] fs/compat: fix parameter handling for compat readv/writev syscalls Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 031/120] fs/compat: fix lookup_dcookie() parameter handling Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 032/120] tile: remove compat_sys_lookup_dcookie declaration to fix compile error Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 033/120] lib/genalloc.c: add check gen_pool_dma_alloc() if dma pointer is not NULL Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 034/120] mtd: mxc_nand: remove duplicated ecc_stats counting Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 035/120] ore: Fix wrong math in allocation of per device BIO Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 036/120] xtensa: xtfpga: fix definitions of platform devices Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 037/120] IB/qib: Fix QP check when looping back to/from QP1 Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 038/120] spi/bcm63xx: dont substract prepend length from total length Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 039/120] spidev: fix hang when transfer_one_message fails Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 040/120] spi/pxa2xx: initialize DMA channels to -1 to prevent inadvertent match Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 041/120] NFSv4: OPEN must handle the NFS4ERR_IO return code correctly Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 042/120] nfs4.1: properly handle ENOTSUP in SECINFO_NO_NAME Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 044/120] NFSv4.1: Handle errors correctly in nfs41_walk_client_list Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 045/120] nfs4: fix discover_server_trunking use after free Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 046/120] pnfs: Proper delay for NFS4ERR_RECALLCONFLICT in layout_get_done Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 047/120] NFSv4: Fix a slot leak in nfs40_sequence_done Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 048/120] sunrpc: Fix infinite loop in RPC state machine Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 049/120] sunrpc: dont wait for write before allowing reads from use-gss-proxy file Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 050/120] dm thin: fix discard support to a previously shared block Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 051/120] dm thin: initialize dm_thin_new_mapping returned by get_next_mapping Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 052/120] dm thin: fix set_pool_mode exposed pool operation races Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 053/120] dm: wait until embedded kobject is released before destroying a device Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 054/120] dm space map common: make sure new space is used during extend Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 055/120] dm space map metadata: fix extending the space map Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 056/120] dm space map metadata: fix bug in resizing of thin metadata Greg Kroah-Hartman
2014-02-11 19:04 ` [PATCH 3.13 058/120] drm/radeon/dpm: disable mclk switching on desktop RV770 Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 060/120] percpu_ida: Make percpu_ida_alloc + callers accept task state bitmask Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 061/120] iscsi-target: Fix connection reset hang with percpu_ida_alloc Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 062/120] numa: add a sysctl for numa_balancing Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 063/120] mm: numa: initialise numa balancing after jump label initialisation Greg Kroah-Hartman
2014-02-11 19:05 ` Greg Kroah-Hartman [this message]
2014-02-11 19:05 ` [PATCH 3.13 065/120] media: media: v4l2-dev: fix video device index assignment Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 066/120] media: anysee: fix non-working E30 Combo Plus DVB-T Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 067/120] [media] dib8000: make 32 bits read atomic Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 068/120] [media] media: s5p_mfc: remove s5p_mfc_get_node_type() function Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 069/120] [media] it913x: Add support for Avermedia H335 id 0x0335 Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 070/120] [media] nxt200x: increase write buffer size Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 071/120] [media] dib8000: fix regression with dib807x Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 072/120] [media] m88rs2000: add m88rs2000_set_carrieroffset Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 073/120] [media] m88rs2000: set symbol rate accurately Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 075/120] Revert "drm/radeon: disable CIK CP semaphores for now" Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 076/120] drm/radeon: disable dpm on BTC Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 077/120] drm/radeon: disable ss on DP for DCE3.x Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 078/120] drm/radeon: fix surface sync in fence on cayman (v2) Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 079/120] drm/radeon: set the full cache bit for fences on r7xx+ Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 080/120] drm/radeon: add UVD support for OLAND Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 081/120] drm/radeon/runpm: dont runtime suspend non-PX cards Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 082/120] drm/radeon: fix DAC interrupt handling on DCE5+ Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 083/120] drm/radeon: set si_notify_smc_display_change properly Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 084/120] drm/radeon/DCE4+: clear bios scratch dpms bit (v2) Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 085/120] drm/radeon/dce8: workaround for atom BlankCrtc table Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 086/120] dm sysfs: fix a module unload race Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 087/120] target: Fix percpu_ref_put race in transport_lun_remove_cmd Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 088/120] drm/nouveau: fix m2mf copy to tiled gart Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 089/120] drm/nouveau/falcon: use vmalloc to create firwmare copies Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 090/120] drm/nouveau: hold mutex while syncing to kernel channel Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 091/120] drm/nouveau: fix lock unbalance in nouveau_crtc_page_flip Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 092/120] drm/i915: Flush outstanding requests before allocating new seqno Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 093/120] drm/i915: Fix the offset issue for the stolen GEM objects Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 094/120] drm/i915: VLV2 - Fix hotplug detect bits Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 095/120] i915: remove pm_qos request on error Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 097/120] drm/cirrus: correct register values for 16bpp Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 098/120] drm/gem: Always initialize the gem object in object_init Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 099/120] drm/rcar-du: Update plane pitch in .mode_set_base() operation Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 100/120] drm/gma500: Lock struct_mutex around cursor updates Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 101/120] drm: ast,cirrus,mgag200: use drm_can_sleep Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 102/120] drm/vmwgfx: Fix the driver for large dma addresses Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 103/120] drm/vmwgfx: Fix regression caused by "drm/ttm: make ttm reservation calls behave like reservation calls" Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 104/120] drm/mgag200: fix oops in cursor code Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 105/120] drm/mgag200: fix typo causing bw limits to be ignored on some chips Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 106/120] drm/mgag200,ast,cirrus: fix regression with drm_can_sleep conversion Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 107/120] ftrace: Synchronize setting function_trace_op with ftrace_trace_function Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 108/120] ftrace: Fix synchronization location disabling and freeing ftrace_ops Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 109/120] ftrace: Have function graph only trace based on global_ops filters Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 110/120] powerpc/thp: Fix crash on mremap Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 111/120] powerpc/mm: Fix compile error of pgtable-ppc64.h Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 112/120] timekeeping: Fix lost updates to tai adjustment Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 113/120] timekeeping: Fix potential lost pv notification of time change Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 114/120] timekeeping: Avoid possible deadlock from clock_was_set_delayed Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 115/120] 3.13.y: timekeeping: Fix clock_set/clock_was_set think-o Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 116/120] timekeeping: Fix CLOCK_TAI timer/nanosleep delays Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 117/120] timekeeping: Fix missing timekeeping_update in suspend path Greg Kroah-Hartman
2014-02-11 19:05 ` [PATCH 3.13 118/120] rtc-cmos: Add an alarm disable quirk Greg Kroah-Hartman
2014-02-11 19:06 ` [PATCH 3.13 119/120] mmc: sdhci-pci: Fix BYT sd card getting stuck in runtime suspend Greg Kroah-Hartman
2014-02-11 19:06 ` [PATCH 3.13 120/120] mmc: sdhci-pci: Fix possibility of chip->fixes being null Greg Kroah-Hartman
2014-02-12  4:29 ` [PATCH 3.13 000/120] 3.13.3-stable review Guenter Roeck
2014-02-12 16:27   ` Greg Kroah-Hartman
2014-02-12 16:45     ` Guenter Roeck
2014-02-12  8:32 ` Willy Tarreau
2014-02-12 16:26   ` Greg Kroah-Hartman
2014-02-12 16:29     ` Willy Tarreau
2014-02-12 20:21       ` Willy Tarreau
2014-02-12 18:49 ` Shuah Khan
2014-02-12 19:16   ` Greg Kroah-Hartman
2014-02-12 23:11 ` Andre Tomt
2014-02-13 11:04 ` Jörg-Volker Peetz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140211184825.444456224@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.cz \
    --cc=rientjes@google.com \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).