linux/arch/arm
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
..
boot power supply and reset changes for the v4.4 series 2015-11-05 12:28:15 -08:00
common genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
configs power supply and reset changes for the v4.4 series 2015-11-05 12:28:15 -08:00
crypto
firmware
include s390: A bunch of fixes and optimizations for interrupt and time 2015-11-05 16:26:26 -08:00
kernel Power management and ACPI updates for v4.4-rc1 2015-11-04 18:10:13 -08:00
kvm arm/arm64: KVM: Improve kvm_exit tracepoint 2015-10-22 23:01:47 +02:00
lib ARM: 8438/1: Add unwinding to __clear_user_std() 2015-10-03 16:36:45 +01:00
mach-alpine
mach-asm9260
mach-at91 clk: at91: add generated clock driver 2015-10-01 12:48:11 -07:00
mach-axxia
mach-bcm ARM: cygnus: fix link failures when CONFIG_COMMON_CLK_IPROC is disabled 2015-10-21 16:52:57 -07:00
mach-berlin
mach-clps711x libnvdimm for 4.3: 2015-09-08 14:35:59 -07:00
mach-cns3xxx
mach-davinci ARM: SoC platform updates for v4.3 2015-09-01 12:18:40 -07:00
mach-digicolor
mach-dove genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
mach-ebsa110
mach-efm32
mach-ep93xx ARM/fb: ep93xx: switch framebuffer to use modedb only 2015-08-13 12:25:44 +02:00
mach-exynos Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-11-03 14:40:01 -08:00
mach-footbridge genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
mach-gemini ARM: gemini: remove unnecessary mdio-gpio includes 2015-10-21 19:50:43 -07:00
mach-highbank
mach-hisi
mach-imx Power management and ACPI updates for v4.4-rc1 2015-11-04 18:10:13 -08:00
mach-integrator
mach-iop13xx genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
mach-iop32x
mach-iop33x
mach-ixp4xx
mach-keystone
mach-ks8695
mach-lpc18xx
mach-lpc32xx genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
mach-mediatek
mach-meson
mach-mmp ARM: mmp: remove unused RTC register definitions 2015-09-05 19:37:17 +02:00
mach-moxart
mach-mv78xx0
mach-mvebu ARM: mvebu: remove static LED setup for netxbig boards 2015-11-03 08:59:30 +01:00
mach-mxs
mach-netx genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
mach-nomadik ARM: nomadik: move l2x0 setup to device tree 2015-08-11 15:29:59 +02:00
mach-nspire
mach-omap1 genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
mach-omap2 Power management and ACPI updates for v4.4-rc1 2015-11-04 18:10:13 -08:00
mach-orion5x ARM: DT updates for v4.3 2015-09-01 13:09:20 -07:00
mach-picoxcell
mach-prima2 Merge branches 'cleanup', 'fixes', 'misc', 'omap-barrier' and 'uaccess' into for-linus 2015-09-03 15:28:37 +01:00
mach-pxa ARM: pxa: fix pxa3xx DFI lockup hack 2015-10-14 17:13:59 +02:00
mach-qcom
mach-realview
mach-rockchip clocksource: cosmetic: Drop OF 'dependency' from symbols 2015-10-01 02:18:39 +02:00
mach-rpc genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
mach-s3c24xx genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
mach-s3c64xx usb: dwc2: rename all s3c_* to dwc2_* 2015-09-27 10:54:31 -05:00
mach-s5pv210
mach-sa1100 genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
mach-shmobile clocksource: cosmetic: Drop OF 'dependency' from symbols 2015-10-01 02:18:39 +02:00
mach-socfpga genalloc: add name arg to gen_pool_get() and devm_gen_pool_create() 2015-09-04 16:54:41 -07:00
mach-spear clocksource: cosmetic: Drop OF 'dependency' from symbols 2015-10-01 02:18:39 +02:00
mach-sti ARM: SoC platform updates for v4.3 2015-09-01 12:18:40 -07:00
mach-stm32
mach-sunxi clocksource: cosmetic: Drop OF 'dependency' from symbols 2015-10-01 02:18:39 +02:00
mach-tegra ARM: SoC driver updates for v4.3 2015-09-01 13:00:04 -07:00
mach-u300 spi: Updates for v4.4 2015-11-05 13:15:12 -08:00
mach-uniphier ARM: uniphier: drop v7_invalidate_l1 call at secondary entry 2015-08-13 12:12:10 +02:00
mach-ux500 clocksource: cosmetic: Drop OF 'dependency' from symbols 2015-10-01 02:18:39 +02:00
mach-versatile
mach-vexpress
mach-vt8500
mach-w90x900
mach-zx ARM: SoC platform updates for v4.3 2015-09-01 12:18:40 -07:00
mach-zynq clocksource: cosmetic: Drop OF 'dependency' from symbols 2015-10-01 02:18:39 +02:00
mm mm, page_alloc: distinguish between being unable to sleep, unwilling to sleep and avoiding waking kswapd 2015-11-06 17:50:42 -08:00
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-10-20 06:08:27 -07:00
nwfpe ARM: swpan: fix nwfpe for uaccess changes 2015-09-09 23:26:11 +01:00
oprofile
plat-iop
plat-omap
plat-orion mvebu fixes for 4.3 (part 1) 2015-10-14 17:10:55 +02:00
plat-pxa ARM: pxa: ssp: Fix build error by removing originally incorrect DT binding 2015-09-13 12:55:27 +02:00
plat-samsung usb: dwc2: rename all s3c_* to dwc2_* 2015-09-27 10:54:31 -05:00
plat-versatile
probes
tools
vdso ARM: 8449/1: fix bug in vdsomunge swab32 macro 2015-10-29 15:20:15 +00:00
vfp
xen mm, page_alloc: distinguish between being unable to sleep, unwilling to sleep and avoiding waking kswapd 2015-11-06 17:50:42 -08:00
Kconfig Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-11-03 14:40:01 -08:00
Kconfig-nommu
Kconfig.debug The i.MX SoC changes for 4.3: 2015-08-18 13:10:05 -07:00
Makefile ARM: 8429/1: disable GCC SRA optimization 2015-09-07 13:24:05 +01:00