linux/drivers/s390/char
Michal Hocko dcda9b0471 mm, tree wide: replace __GFP_REPEAT by __GFP_RETRY_MAYFAIL with more useful semantic
__GFP_REPEAT was designed to allow retry-but-eventually-fail semantic to
the page allocator.  This has been true but only for allocations
requests larger than PAGE_ALLOC_COSTLY_ORDER.  It has been always
ignored for smaller sizes.  This is a bit unfortunate because there is
no way to express the same semantic for those requests and they are
considered too important to fail so they might end up looping in the
page allocator for ever, similarly to GFP_NOFAIL requests.

Now that the whole tree has been cleaned up and accidental or misled
usage of __GFP_REPEAT flag has been removed for !costly requests we can
give the original flag a better name and more importantly a more useful
semantic.  Let's rename it to __GFP_RETRY_MAYFAIL which tells the user
that the allocator would try really hard but there is no promise of a
success.  This will work independent of the order and overrides the
default allocator behavior.  Page allocator users have several levels of
guarantee vs.  cost options (take GFP_KERNEL as an example)

 - GFP_KERNEL & ~__GFP_RECLAIM - optimistic allocation without _any_
   attempt to free memory at all. The most light weight mode which even
   doesn't kick the background reclaim. Should be used carefully because
   it might deplete the memory and the next user might hit the more
   aggressive reclaim

 - GFP_KERNEL & ~__GFP_DIRECT_RECLAIM (or GFP_NOWAIT)- optimistic
   allocation without any attempt to free memory from the current
   context but can wake kswapd to reclaim memory if the zone is below
   the low watermark. Can be used from either atomic contexts or when
   the request is a performance optimization and there is another
   fallback for a slow path.

 - (GFP_KERNEL|__GFP_HIGH) & ~__GFP_DIRECT_RECLAIM (aka GFP_ATOMIC) -
   non sleeping allocation with an expensive fallback so it can access
   some portion of memory reserves. Usually used from interrupt/bh
   context with an expensive slow path fallback.

 - GFP_KERNEL - both background and direct reclaim are allowed and the
   _default_ page allocator behavior is used. That means that !costly
   allocation requests are basically nofail but there is no guarantee of
   that behavior so failures have to be checked properly by callers
   (e.g. OOM killer victim is allowed to fail currently).

 - GFP_KERNEL | __GFP_NORETRY - overrides the default allocator behavior
   and all allocation requests fail early rather than cause disruptive
   reclaim (one round of reclaim in this implementation). The OOM killer
   is not invoked.

 - GFP_KERNEL | __GFP_RETRY_MAYFAIL - overrides the default allocator
   behavior and all allocation requests try really hard. The request
   will fail if the reclaim cannot make any progress. The OOM killer
   won't be triggered.

 - GFP_KERNEL | __GFP_NOFAIL - overrides the default allocator behavior
   and all allocation requests will loop endlessly until they succeed.
   This might be really dangerous especially for larger orders.

Existing users of __GFP_REPEAT are changed to __GFP_RETRY_MAYFAIL
because they already had their semantic.  No new users are added.
__alloc_pages_slowpath is changed to bail out for __GFP_RETRY_MAYFAIL if
there is no progress and we have already passed the OOM point.

This means that all the reclaim opportunities have been exhausted except
the most disruptive one (the OOM killer) and a user defined fallback
behavior is more sensible than keep retrying in the page allocator.

[akpm@linux-foundation.org: fix arch/sparc/kernel/mdesc.c]
[mhocko@suse.com: semantic fix]
  Link: http://lkml.kernel.org/r/20170626123847.GM11534@dhcp22.suse.cz
[mhocko@kernel.org: address other thing spotted by Vlastimil]
  Link: http://lkml.kernel.org/r/20170626124233.GN11534@dhcp22.suse.cz
Link: http://lkml.kernel.org/r/20170623085345.11304-3-mhocko@kernel.org
Signed-off-by: Michal Hocko <mhocko@suse.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Alex Belits <alex.belits@cavium.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Darrick J. Wong <darrick.wong@oracle.com>
Cc: David Daney <david.daney@cavium.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: NeilBrown <neilb@suse.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-07-12 16:26:03 -07:00
..
Kconfig
Makefile s390/sclp: move early printk code to drivers 2017-02-08 14:13:17 +01:00
con3215.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
con3270.c s390: use false/true when using bool 2017-01-16 07:27:54 +01:00
ctrlchar.c
ctrlchar.h
defkeymap.c
defkeymap.map
diag_ftp.c
diag_ftp.h
fs3270.c sched/headers: Prepare for new header dependencies before moving code to <linux/sched/signal.h> 2017-03-02 08:42:29 +01:00
hmcdrv_cache.c
hmcdrv_cache.h
hmcdrv_dev.c
hmcdrv_dev.h
hmcdrv_ftp.c
hmcdrv_ftp.h
hmcdrv_mod.c
keyboard.c s390 keyboard.c: don't open-code strndup_user() 2017-05-15 23:41:50 -04:00
keyboard.h
monreader.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
monwriter.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
raw3270.c s390: use false/true when using bool 2017-01-16 07:27:54 +01:00
raw3270.h
sclp.c s390: drivers: convert to use DRIVER_ATTR_RO/WO 2017-06-12 16:14:31 +02:00
sclp.h s390/sclp: get rid of common response code handling 2017-02-08 14:13:21 +01:00
sclp_async.c
sclp_cmd.c s390/smp: initialize cpu_present_mask in setup_arch 2016-12-07 07:23:07 +01:00
sclp_con.c s390/console: Make preferred console handling more consistent 2016-07-13 10:58:07 +02:00
sclp_config.c s390/cpuinfo: show dynamic and static cpu mhz 2016-06-13 15:58:17 +02:00
sclp_cpi_sys.c
sclp_cpi_sys.h
sclp_ctl.c s390: char: make slp_ctl explicitly non-modular 2016-11-10 16:55:46 +01:00
sclp_diag.h
sclp_early.c s390/sclp: Detect KSS facility 2017-04-21 11:08:04 +02:00
sclp_early_core.c s390/sclp: get rid of common response code handling 2017-02-08 14:13:21 +01:00
sclp_ftp.c
sclp_ftp.h
sclp_ocf.c s390: Make cpc_name accessible 2016-06-10 12:07:10 +02:00
sclp_pci.c
sclp_quiesce.c s390: char: make slcp_quiesce explicitly non-modular 2016-10-31 17:55:39 +01:00
sclp_rw.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
sclp_rw.h
sclp_sdias.c
sclp_sdias.h
sclp_tty.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
sclp_tty.h
sclp_vt220.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
tape.h
tape_34xx.c
tape_3590.c s390/tape: Use memdup_user() rather than duplicating its implementation 2016-08-24 09:23:57 +02:00
tape_3590.h
tape_char.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
tape_class.c
tape_class.h
tape_core.c
tape_proc.c
tape_std.c
tape_std.h
tty3270.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
tty3270.h
vmcp.c mm, tree wide: replace __GFP_REPEAT by __GFP_RETRY_MAYFAIL with more useful semantic 2017-07-12 16:26:03 -07:00
vmcp.h
vmlogrdr.c s390: drivers: convert to use DRIVER_ATTR_RO/WO 2017-06-12 16:14:31 +02:00
vmur.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
vmur.h
zcore.c s390: proper type casts for csum_partial invocations 2017-01-16 07:27:53 +01:00