linux/drivers/gpu/drm
Mel Gorman d0164adc89 mm, page_alloc: distinguish between being unable to sleep, unwilling to sleep and avoiding waking kswapd
__GFP_WAIT has been used to identify atomic context in callers that hold
spinlocks or are in interrupts.  They are expected to be high priority and
have access one of two watermarks lower than "min" which can be referred
to as the "atomic reserve".  __GFP_HIGH users get access to the first
lower watermark and can be called the "high priority reserve".

Over time, callers had a requirement to not block when fallback options
were available.  Some have abused __GFP_WAIT leading to a situation where
an optimisitic allocation with a fallback option can access atomic
reserves.

This patch uses __GFP_ATOMIC to identify callers that are truely atomic,
cannot sleep and have no alternative.  High priority users continue to use
__GFP_HIGH.  __GFP_DIRECT_RECLAIM identifies callers that can sleep and
are willing to enter direct reclaim.  __GFP_KSWAPD_RECLAIM to identify
callers that want to wake kswapd for background reclaim.  __GFP_WAIT is
redefined as a caller that is willing to enter direct reclaim and wake
kswapd for background reclaim.

This patch then converts a number of sites

o __GFP_ATOMIC is used by callers that are high priority and have memory
  pools for those requests. GFP_ATOMIC uses this flag.

o Callers that have a limited mempool to guarantee forward progress clear
  __GFP_DIRECT_RECLAIM but keep __GFP_KSWAPD_RECLAIM. bio allocations fall
  into this category where kswapd will still be woken but atomic reserves
  are not used as there is a one-entry mempool to guarantee progress.

o Callers that are checking if they are non-blocking should use the
  helper gfpflags_allow_blocking() where possible. This is because
  checking for __GFP_WAIT as was done historically now can trigger false
  positives. Some exceptions like dm-crypt.c exist where the code intent
  is clearer if __GFP_DIRECT_RECLAIM is used instead of the helper due to
  flag manipulations.

o Callers that built their own GFP flags instead of starting with GFP_KERNEL
  and friends now also need to specify __GFP_KSWAPD_RECLAIM.

The first key hazard to watch out for is callers that removed __GFP_WAIT
and was depending on access to atomic reserves for inconspicuous reasons.
In some cases it may be appropriate for them to use __GFP_HIGH.

The second key hazard is callers that assembled their own combination of
GFP flags instead of starting with something like GFP_KERNEL.  They may
now wish to specify __GFP_KSWAPD_RECLAIM.  It's almost certainly harmless
if it's missed in most cases as other activity will wake kswapd.

Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Vitaly Wool <vitalywool@gmail.com>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-11-06 17:50:42 -08:00
..
amd drm/amdgpu: don't try to recreate sysfs entries on resume 2015-10-23 10:45:35 -04:00
armada drm/armada: Use new drm_fb_helper functions 2015-08-06 14:12:56 +02:00
ast drm/ast: Don't grab dev->struct_mutex for in mmap offset ioctl 2015-08-10 13:36:55 +02:00
atmel-hlcdc Linux 4.2-rc8 2015-08-24 16:36:42 +10:00
bochs drm/bochs: Don't grab dev->struct_mutex for in mmap offset ioctl 2015-08-10 13:37:04 +02:00
bridge Merge branch 'drm-dwhdmi-devel' of git://ftp.arm.linux.org.uk/~rmk/linux-arm into drm-next 2015-08-27 13:01:57 +10:00
cirrus drm/cirrus: Don't grab dev->struct_mutex for in mmap offset ioctl 2015-08-10 13:37:27 +02:00
exynos drm/exynos: Staticize local function in exynos_drm_gem.c 2015-10-01 14:29:51 +09:00
fsl-dcu drm/layerscape: fix handling fsl_dcu_drm_plane_index result 2015-09-24 08:13:09 +10:00
gma500 drm/gma500: Use new drm_fb_helper functions 2015-08-06 14:12:59 +02:00
i2c Merge remote-tracking branches 'asoc/topic/rcar', 'asoc/topic/reg-default', 'asoc/topic/rl6231', 'asoc/topic/rockchip' and 'asoc/topic/rt286' into asoc-next 2015-08-30 15:55:54 +01:00
i810
i915 mm, page_alloc: distinguish between being unable to sleep, unwilling to sleep and avoiding waking kswapd 2015-11-06 17:50:42 -08:00
imx Merge branch 'drm-dwhdmi-devel' of git://ftp.arm.linux.org.uk/~rmk/linux-arm into drm-next 2015-08-27 13:01:57 +10:00
mga
mgag200 drm/mgag200: Fix driver_load error handling 2015-09-24 08:10:44 +10:00
msm gpu/drm: Kill off set_irq_flags usage 2015-09-16 16:53:38 +02:00
nouveau drm/nouveau/gem: return only valid domain when there's only one 2015-10-22 09:10:52 +10:00
omapdrm drm/omap: Use new drm_fb_helper functions 2015-08-06 14:13:03 +02:00
panel spi: Drop owner assignment from spi_drivers 2015-10-28 10:30:17 +09:00
qxl drm/qxl: avoid dependency lock 2015-10-07 15:33:45 +10:00
r128
radeon drm/radeon: fix dpms when driver backlight control is disabled 2015-10-29 11:13:40 -04:00
rcar-du
rockchip drm/rockchip: vop: support plane scale 2015-08-26 14:16:26 +08:00
savage
shmobile
sis
sti Merge branch 'drm-sti-next-atomic-2015-08-11' of http://git.linaro.org/people/benjamin.gaignard/kernel into drm-next 2015-08-14 10:14:23 +10:00
tdfx
tegra drm/tegra: Changes for v4.3-rc1 2015-08-17 15:52:39 +10:00
tilcdc
ttm drm/ttm: Fix memory space allocation v2 2015-09-15 00:57:01 -07:00
udl drm/udl: Use new drm_fb_helper functions 2015-08-06 14:13:00 +02:00
vgem mm: mark most vm_operations_struct const 2015-09-10 13:29:01 -07:00
via treewide: fix typos in comment blocks 2015-08-07 14:46:24 +02:00
virtio drm/virtio: use %llu format string form atomic64_t 2015-10-16 11:36:36 +10:00
vmwgfx Merge branch 'vmwgfx-fixes-4.3' of git://people.freedesktop.org/~thomash/linux 2015-10-25 05:02:33 +10:00
ati_pcigart.c
drm_agpsupport.c
drm_atomic_helper.c Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2015-09-04 15:49:32 -07:00
drm_atomic.c drm/atomic: Fix bookkeeping with TEST_ONLY, v3. 2015-09-01 11:57:06 +03:00
drm_auth.c
drm_bridge.c
drm_bufs.c
drm_cache.c
drm_context.c
drm_crtc_helper.c
drm_crtc_internal.h
drm_crtc.c drm: Correct arguments to list_tail_add in create blob ioctl 2015-10-31 10:22:26 +10:00
drm_debugfs.c
drm_dma.c
drm_dp_helper.c drm/dp: Add dp_aux_i2c_speed_khz module param to set the assume i2c bus speed 2015-09-02 16:13:43 +03:00
drm_dp_mst_topology.c drm: fix mutex leak in drm_dp_get_mst_branch_device 2015-10-22 08:29:08 +10:00
drm_drv.c
drm_edid_load.c
drm_edid.c drm/edid: Use ARRAY_SIZE in drm_add_modes_noedid 2015-08-11 12:04:16 +02:00
drm_encoder_slave.c
drm_fb_cma_helper.c drm/fb_cma_helper: Use new drm_fb_helper functions 2015-08-06 14:13:00 +02:00
drm_fb_helper.c drm: handle cursor_set2 in restore_fbdev_mode 2015-10-02 15:30:41 +10:00
drm_flip_work.c
drm_fops.c
drm_gem_cma_helper.c drm/cma-helper: Don't grab dev->struct_mutex for in mmap offset ioctl 2015-08-10 13:37:36 +02:00
drm_gem.c drm/gem: Be more friendly with locking checks 2015-08-10 13:35:49 +02:00
drm_global.c
drm_hashtab.c
drm_info.c
drm_internal.h
drm_ioc32.c
drm_ioctl.c drm: Allow also control clients to check the drm version 2015-09-24 00:24:24 -07:00
drm_irq.c Linux 4.2-rc7 2015-08-17 14:13:53 +10:00
drm_legacy.h
drm_lock.c
drm_memory.c
drm_mipi_dsi.c
drm_mm.c
drm_modes.c
drm_modeset_lock.c drm: Remove __drm_modeset_lock_all 2015-08-06 14:13:02 +02:00
drm_of.c
drm_panel.c
drm_pci.c
drm_plane_helper.c
drm_platform.c
drm_prime.c
drm_probe_helper.c drm: Add a non-locking version of drm_kms_helper_poll_enable(), v2 2015-09-30 16:04:08 +03:00
drm_rect.c
drm_scatter.c
drm_sysfs.c drm: Fix locking for sysfs dpms file 2015-10-09 10:19:14 +10:00
drm_trace_points.c
drm_trace.h
drm_vm.c
drm_vma_manager.c
Kconfig Merge branch 'drm-next-fsl-dcu' of https://github.com/Jianwei-Wang/linux-drm-fsl-dcu into drm-next 2015-08-20 14:11:17 +10:00
Makefile drm/layerscape: Add Freescale DCU DRM driver 2015-08-19 22:23:04 -04:00