1
0
Fork 0
alistair23-linux/tools/perf
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
..
Documentation perf intel-pt: Update documentation to include new ptwrite and power events 2017-06-30 11:50:54 -03:00
arch x86/insn: perf tools: Add new ptwrite instruction 2017-06-27 11:58:04 -03:00
bench perf tools: Use __maybe_unused consistently 2017-06-19 15:27:06 -03:00
jvmti perf jit: fix typo: "incalid" -> "invalid" 2017-06-27 11:55:06 -03:00
pmu-events perf tools: Use __maybe_unused consistently 2017-06-19 15:27:06 -03:00
python perf python: Add tracepoint example 2016-07-12 16:23:35 -03:00
scripts perf intel-pt: Add example script for power events and PTWRITE 2017-06-30 11:50:53 -03:00
tests perf tools: Kill die() 2017-06-27 11:49:13 -03:00
trace perf tools: Add signal.h to places using its definitions 2017-04-20 13:22:43 -03:00
ui perf annotate: Return arch from symbol__disassemble() and save it in browser 2017-06-19 15:27:09 -03:00
util perf/urgent fixes: 2017-07-05 09:10:37 +02:00
.gitignore perf tools: Ignore generated files pmu-events/{jevents,pmu-events.c} for git 2017-03-13 10:59:36 -03:00
Build perf trace: Beautify statx syscall 'flag' and 'mask' arguments 2017-03-31 14:42:31 -03:00
CREDITS
MANIFEST tools include: Introduce linux/bug.h, from the kernel sources 2017-04-19 13:01:42 -03:00
Makefile perf build tests: Do parallell builds with 'build-test' 2016-02-04 15:57:00 -03:00
Makefile.config perf unwind: Support for powerpc 2017-06-21 11:35:42 -03:00
Makefile.perf perf tools: Fix build with ARCH=x86_64 2017-06-14 15:44:29 -03:00
builtin-annotate.c perf tools: Include errno.h where needed 2017-04-19 13:01:51 -03:00
builtin-bench.c perf tools: Remove unused 'prefix' from builtin functions 2017-03-27 11:58:09 -03:00
builtin-buildid-cache.c perf symbols: Accept symbols starting at address 0 2017-05-02 18:23:04 -03:00
builtin-buildid-list.c perf tools: Include errno.h where needed 2017-04-19 13:01:51 -03:00
builtin-c2c.c perf tools: Replace error() with pr_err() 2017-06-27 11:22:31 -03:00
builtin-config.c perf config: Refactor the code using 'ret' variable in cmd_config() 2017-06-19 22:05:55 -03:00
builtin-data.c perf tools: Remove unused 'prefix' from builtin functions 2017-03-27 11:58:09 -03:00
builtin-diff.c perf config: Do not die when parsing u64 or int config values 2017-06-27 11:44:58 -03:00
builtin-evlist.c perf tools: Remove unused 'prefix' from builtin functions 2017-03-27 11:58:09 -03:00
builtin-ftrace.c perf ftrace: Add -D option for depth filter 2017-06-19 22:05:54 -03:00
builtin-help.c perf tools: Replace error() with pr_err() 2017-06-27 11:22:31 -03:00
builtin-inject.c perf tools: Use just forward declarations for struct thread where possible 2017-04-24 13:43:35 -03:00
builtin-kallsyms.c perf tools: Including missing inttypes.h header 2017-04-19 13:01:46 -03:00
builtin-kmem.c mm, tree wide: replace __GFP_REPEAT by __GFP_RETRY_MAYFAIL with more useful semantic 2017-07-12 16:26:03 -07:00
builtin-kvm.c perf tools: Remove poll.h and wait.h from util.h 2017-04-24 13:43:34 -03:00
builtin-list.c perf tools: Remove unused 'prefix' from builtin functions 2017-03-27 11:58:09 -03:00
builtin-lock.c perf tools: Include errno.h where needed 2017-04-19 13:01:51 -03:00
builtin-mem.c perf tools: Use just forward declarations for struct thread where possible 2017-04-24 13:43:35 -03:00
builtin-probe.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2017-05-02 19:09:35 -07:00
builtin-record.c perf tools: Replace error() with pr_err() 2017-06-27 11:22:31 -03:00
builtin-report.c perf auxtrace: Add CPU filter support 2017-06-30 11:50:55 -03:00
builtin-sched.c perf tools: Replace error() with pr_err() 2017-06-27 11:22:31 -03:00
builtin-script.c perf auxtrace: Add CPU filter support 2017-06-30 11:50:55 -03:00
builtin-stat.c perf tools: Replace error() with pr_err() 2017-06-27 11:22:31 -03:00
builtin-timechart.c perf tools: Use just forward declarations for struct thread where possible 2017-04-24 13:43:35 -03:00
builtin-top.c perf tools: Replace error() with pr_err() 2017-06-27 11:22:31 -03:00
builtin-trace.c perf trace: Add mmap alias for s390 2017-06-01 10:13:21 -03:00
builtin-version.c perf tools: Remove string.h, unistd.h and sys/stat.h from util.h 2017-04-24 13:43:33 -03:00
builtin.h perf tools: Remove stale prototypes from builtin.h 2017-04-24 13:43:33 -03:00
check-headers.sh tools include uapi: Grab copies of stat.h and fcntl.h 2017-03-31 11:26:03 -03:00
command-list.txt perf tools: Missing c2c command in command-list 2017-03-13 10:59:31 -03:00
design.txt perf tools: Update some code references in design.txt 2014-03-18 18:17:06 -03:00
perf-archive.sh
perf-completion.sh perf tools: Avoid confusion with preloaded bash function for perf bash completion 2015-03-19 13:53:27 -03:00
perf-read-vdso.c perf tools: Build programs to copy 32-bit compatibility 2014-10-29 10:32:48 -02:00
perf-sys.h perf powerpc: Fix build-test failure 2016-09-08 13:44:07 -03:00
perf-with-kcore.sh perf tools: Fix perf-with-kcore handling of arguments containing spaces 2015-08-06 16:48:27 -03:00
perf.c perf tools: Move event prototypes from util.h to event.h 2017-04-25 15:30:47 -03:00
perf.h perf tools: Add PERF_RECORD_NAMESPACES to include namespaces related info 2017-03-14 11:38:23 -03:00