remarkable-linux/Documentation
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
..
ABI There is a nice new document from Neil on how pathname lookups work and 2015-11-05 15:59:24 -08:00
accounting
acpi mfd: core: redo ACPI matching of the children devices 2015-10-26 15:25:53 +01:00
aoe
arm arm64 updates for 4.4: 2015-11-04 14:47:13 -08:00
arm64 arm64 updates for 4.4: 2015-11-04 14:47:13 -08:00
auxdisplay
backlight
blackfin
block block: add an API for Persistent Reservations 2015-10-21 14:46:56 -06:00
blockdev zram: update documentation 2015-09-24 15:39:42 -06:00
bus-devices
cdrom
cgroups There is a nice new document from Neil on how pathname lookups work and 2015-11-05 15:59:24 -08:00
cma
connector
console
cpu-freq
cpuidle
cris
crypto KEYS: Merge the type-specific data with the payload data 2015-10-21 15:18:36 +01:00
development-process
device-mapper - Revert a dm-multipath change that caused a regression for unprivledged 2015-11-04 21:19:53 -08:00
devicetree - New Device Support 2015-11-06 10:53:48 -08:00
dmaengine
DocBook There is a nice new document from Neil on how pathname lookups work and 2015-11-05 15:59:24 -08:00
driver-model driver-core: platform: Provide helpers for multi-driver modules 2015-10-05 05:02:40 +01:00
dvb
early-userspace
EDID
extcon
fault-injection
fb
features arm64 updates for 4.4: 2015-11-04 14:47:13 -08:00
filesystems Merge branch 'akpm' (patches from Andrew) 2015-11-05 23:10:54 -08:00
firmware_class
fmc
fpga usage documentation for FPGA manager core 2015-10-07 18:07:20 +01:00
frv
gpio There is a nice new document from Neil on how pathname lookups work and 2015-11-05 15:59:24 -08:00
hid
hwmon hwmon: (lm75) Add support for TMP75C 2015-10-14 07:57:14 -07:00
i2c
ia64
ide
infiniband
input Input: fix typo in MT documentation 2015-09-19 11:39:02 -07:00
ioctl char/misc drivers for 4.4-rc1 2015-11-04 22:15:15 -08:00
isdn
ja_JP
kbuild
kdump
ko_KR
laptops
leds
locking Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-11-03 16:10:43 -08:00
m68k
memory-devices
metag
mic misc: mic: Update MIC host daemon with COSM changes 2015-10-04 12:54:54 +01:00
mips
misc-devices Doc:misc-devices: Fix typo in Documentation/misc-devices 2015-09-18 10:04:24 -06:00
mmc mmc: core: Remove MMC_CLKGATE 2015-10-26 16:00:09 +01:00
mn10300
mtd
namespaces
netlabel
networking There is a nice new document from Neil on how pathname lookups work and 2015-11-05 15:59:24 -08:00
nfc
nios2
nvdimm
nvmem
parisc
PCI
pcmcia
phy
platform
power PCI / PM: Update runtime PM documentation for PCI devices 2015-09-25 02:48:44 +02:00
powerpc
pps
prctl
pti
ptp testptp: Silence compiler warnings on ppc64 2015-09-29 21:16:56 -07:00
rapidio
RCU Merge branches 'doc.2015.10.06a', 'percpu-rwsem.2015.10.06a' and 'torture.2015.10.06a' into HEAD 2015-10-07 16:06:25 -07:00
s390
scheduler
scsi
security KEYS: Merge the type-specific data with the payload data 2015-10-21 15:18:36 +01:00
serial Documentation: improve line discipline method descriptions 2015-10-05 04:53:26 +01:00
sh
sound
spi
sysctl kernel/watchdog.c: perform all-CPU backtrace in case of hard lockup 2015-11-05 19:34:48 -08:00
target
thermal thermal: power_allocator: relax the requirement of two passive trip points 2015-09-14 07:41:45 -07:00
timers
tpm
trace intel_th: Add driver infrastructure for Intel(R) Trace Hub devices 2015-10-04 20:28:58 +01:00
usb usb: interface authorization: Documentation part 2015-09-22 12:08:40 -07:00
vDSO
video4linux [media] media: videobuf2: Change queue_setup argument 2015-10-20 14:48:39 -02:00
virtual s390: A bunch of fixes and optimizations for interrupt and time 2015-11-05 16:26:26 -08:00
vm mm, page_alloc: distinguish between being unable to sleep, unwilling to sleep and avoiding waking kswapd 2015-11-06 17:50:42 -08:00
w1 w1: masters: omap_hdq: add support for 1-wire mode 2015-10-05 04:47:09 +01:00
watchdog Documentation/watchdog: add timeout and ping rate control to watchdog-test.c 2015-09-09 21:33:36 +02:00
wimax
x86
xtensa
zh_CN sysfs.txt: fix pre-kernfs sysfs_dirent reference 2015-09-13 14:38:50 -06:00
00-INDEX
adding-syscalls.txt
applying-patches.txt
assoc_array.txt
atomic_ops.txt locking/atomics, cmpxchg: Privatize the inclusion of asm/cmpxchg.h 2015-09-13 10:35:46 +02:00
bad_memory.txt
basic_profiling.txt
bcache.txt
binfmt_misc.txt
braille-console.txt
bt8xxgpio.txt
btmrvl.txt
BUG-HUNTING
bus-virt-phys-mapping.txt
cachetlb.txt
Changes There is a nice new document from Neil on how pathname lookups work and 2015-11-05 15:59:24 -08:00
circular-buffers.txt
clk.txt
coccinelle.txt
CodeOfConflict
CodingStyle
cpu-hotplug.txt
cpu-load.txt
cputopology.txt
crc32.txt
dcdbas.txt
debugging-modules.txt
debugging-via-ohci1394.txt
dell_rbu.txt
devices.txt
digsig.txt
DMA-API-HOWTO.txt Documentation: DMA API: Be more explicit that nents is always the same 2015-09-24 15:50:06 -06:00
DMA-API.txt Documentation: DMA API: Be more explicit that nents is always the same 2015-09-24 15:50:06 -06:00
DMA-attributes.txt
dma-buf-sharing.txt
DMA-ISA-LPC.txt
dontdiff
dynamic-debug-howto.txt
edac.txt Documentation/EDAC: Add reference documents section for amd64_edac 2015-09-29 13:42:41 +02:00
efi-stub.txt
eisa.txt
email-clients.txt Documentation/email-clients.txt: remove trailing whitespace 2015-10-11 15:31:57 -06:00
flexible-arrays.txt
futex-requeue-pi.txt
gcov.txt
gdb-kernel-debugging.txt
highuid.txt
HOWTO
hsi.txt
hw_random.txt hwrng: doc - Fix device node name reference /dev/hw_random => /dev/hwrng 2015-09-21 22:00:41 +08:00
hwspinlock.txt
init.txt
initrd.txt
Intel-IOMMU.txt
intel_txt.txt
io-mapping.txt
io_ordering.txt
iostats.txt
IPMI.txt
IRQ-affinity.txt
IRQ-domain.txt irqdomain: Documentation updates 2015-10-13 19:01:25 +02:00
IRQ.txt
irqflags-tracing.txt
isapnp.txt
java.txt
kasan.txt mm, slub, kasan: enable user tracking by default with KASAN=y 2015-11-05 19:34:48 -08:00
kernel-doc-nano-HOWTO.txt
kernel-docs.txt kernel-docs.txt: update kernelnewbies reference 2015-10-11 15:36:43 -06:00
kernel-parameters.txt Merge branch 'akpm' (patches from Andrew) 2015-11-05 23:10:54 -08:00
kernel-per-CPU-kthreads.txt
kmemcheck.txt
kmemleak.txt
kobject.txt
kprobes.txt
kref.txt
kselftest.txt Documentation: Update kselftest.txt 2015-09-24 15:51:53 -06:00
ldm.txt
local_ops.txt
lockup-watchdogs.txt kernel/watchdog.c: add sysctl knob hardlockup_panic 2015-11-05 19:34:48 -08:00
logo.gif
logo.txt
lzo.txt
magic-number.txt
mailbox.txt
Makefile
ManagementStyle
md-cluster.txt
md.txt
media-framework.txt
memory-barriers.txt atomic: remove all traces of READ_ONCE_CTRL() and atomic*_read_ctrl() 2015-11-03 17:22:17 -08:00
memory-hotplug.txt
men-chameleon-bus.txt
module-signing.txt
mono.txt
nommu-mmap.txt
ntb.txt
numastat.txt
oops-tracing.txt
padata.txt
parport-lowlevel.txt
parport.txt
percpu-rw-semaphore.txt
phy.txt
pi-futex.txt
pinctrl.txt
pnp.txt
preempt-locking.txt
printk-formats.txt
pwm.txt
ramoops.txt
rbtree.txt documentation: fix small typo in rbtree.txt 2015-09-13 14:38:50 -06:00
remoteproc.txt
rfkill.txt
robust-futex-ABI.txt
robust-futexes.txt
rpmsg.txt
rtc.txt
SAK.txt
SecurityBugs
serial-console.txt
sgi-ioc4.txt
SM501.txt
smsc_ece1099.txt
sparse.txt
stable_api_nonsense.txt
stable_kernel_rules.txt
static-keys.txt locking/static_keys: Fix up the static keys documentation 2015-09-15 07:12:06 +02:00
SubmitChecklist
SubmittingDrivers
SubmittingPatches SubmittingPatches: make Subject examples match the de facto standard 2015-09-24 15:57:42 -06:00
svga.txt
sysfs-rules.txt
sysrq.txt mm, oom: do not panic for oom kills triggered from sysrq 2015-09-08 15:35:28 -07:00
this_cpu_ops.txt
unaligned-memory-access.txt
unicode.txt
unshare.txt
vfio.txt
VGA-softcursor.txt
vgaarbiter.txt
video-output.txt
vme_api.txt
volatile-considered-harmful.txt
workqueue.txt
xillybus.txt
xz.txt
zorro.txt