linux/include
Michal Hocko 7e35ef0434 OOM, PM: OOM killed task shouldn't escape PM suspend
commit 5695be142e upstream.

PM freezer relies on having all tasks frozen by the time devices are
getting frozen so that no task will touch them while they are getting
frozen. But OOM killer is allowed to kill an already frozen task in
order to handle OOM situtation. In order to protect from late wake ups
OOM killer is disabled after all tasks are frozen. This, however, still
keeps a window open when a killed task didn't manage to die by the time
freeze_processes finishes.

Reduce the race window by checking all tasks after OOM killer has been
disabled. This is still not race free completely unfortunately because
oom_killer_disable cannot stop an already ongoing OOM killer so a task
might still wake up from the fridge and get killed without
freeze_processes noticing. Full synchronization of OOM and freezer is,
however, too heavy weight for this highly unlikely case.

Introduce and check oom_kills counter which gets incremented early when
the allocator enters __alloc_pages_may_oom path and only check all the
tasks if the counter changes during the freezing attempt. The counter
is updated so early to reduce the race window since allocator checked
oom_killer_disabled which is set by PM-freezing code. A false positive
will push the PM-freezer into a slow path but that is not a big deal.

Changes since v1
- push the re-check loop out of freeze_processes into
  check_frozen_processes and invert the condition to make the code more
  readable as per Rafael

Fixes: f660daac47 (oom: thaw threads if oom killed thread is frozen before deferring)
Signed-off-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
History 2014-11-05 11:43:09 +00:00
..
acpi ACPI / hotplug: Generate online uevents for ACPI containers 2014-10-05 13:41:02 -07:00
asm-generic core: fix typo in percpu read_mostly section 2014-07-01 16:45:22 -04:00
clocksource drivers: clocksource: add support for ARM architected timer event stream 2013-09-26 09:48:00 +01:00
crypto crypto: hash - Add real ahash walk interface 2014-05-21 20:56:12 +08:00
drm drm/ttm: fix handling of TTM_PL_FLAG_TOPDOWN v2 2014-10-05 13:40:50 -07:00
dt-bindings Two regression fixes for omaps and one fix for device signaling: 2014-07-24 14:06:33 +02:00
keys KEYS: Separate the kernel signature checking keyring from module signing 2013-09-25 17:17:01 +01:00
kvm ARM: KVM: fix non-VGIC compilation 2014-03-06 09:47:42 +01:00
linux OOM, PM: OOM killed task shouldn't escape PM suspend 2014-11-05 11:43:09 +00:00
math-emu math-emu: fix floating-point to integer overflow detection 2014-01-07 18:36:24 -06:00
media media: vb2: fix VBI/poll regression 2014-10-09 12:23:49 -07:00
memory ddr: add LPDDR2 data from JESD209-2 2012-05-02 00:04:06 -07:00
misc [media] altera-stapl: it is time to move out from staging 2011-09-23 15:00:57 -03:00
net sctp: handle association restarts when the socket is closed. 2014-10-15 12:05:30 +02:00
pcmcia pcmcia/ds.h: introduce helper for pcmcia_driver module boilerplate 2013-03-15 12:26:03 -07:00
ras edac: add support for error type "Info" 2013-02-21 14:16:27 -03:00
rdma Merge branches 'core', 'cxgb3', 'cxgb4', 'iser', 'iwpm', 'misc', 'mlx4', 'mlx5', 'noio', 'ocrdma', 'qib', 'srp' and 'usnic' into for-next 2014-06-10 10:12:14 -07:00
rxrpc atomic: use <linux/atomic.h> 2011-07-26 16:49:47 -07:00
scsi scsi: do not issue SCSI RSOC command to Promise Vtrak E610f 2014-09-17 09:22:00 -07:00
sound ALSA: control: Protect user controls against concurrent access 2014-06-18 15:12:33 +02:00
target target: Report correct response length for some commands 2014-06-11 12:15:30 -07:00
trace tracing: Add __field_struct macro for TRACE_EVENT() 2014-06-21 00:18:42 -04:00
uapi Drivers: hv: util: Properly pack the data for file copy functionality 2014-10-30 09:40:12 -07:00
video Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2014-06-12 11:32:30 -07:00
xen Fix BUG when trying to expand the grant table. This seems to occur 2014-07-30 09:00:20 -07:00
Kbuild UAPI: remove empty Kbuild files 2013-04-30 17:04:09 -07:00