mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
mm/page_alloc.c: allow error injection
Model call chain after should_failslab(). Likewise, we can now use a kprobe to override the return value of should_fail_alloc_page() and inject allocation failures into alloc_page*(). This will allow injecting allocation failures using the BCC tools even without building kernel with CONFIG_FAIL_PAGE_ALLOC and booting it with a fail_page_alloc= parameter, which incurs some overhead even when failures are not being injected. On the other hand, this patch adds an unconditional call to should_fail_alloc_page() from page allocation hotpath. That overhead should be rather negligible with CONFIG_FAIL_PAGE_ALLOC=n when there's no kprobe attached, though. [[email protected]: changelog addition] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Benjamin Poirier <[email protected]> Acked-by: Vlastimil Babka <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Pavel Tatashin <[email protected]> Cc: Oscar Salvador <[email protected]> Cc: Mike Rapoport <[email protected]> Cc: Joonsoo Kim <[email protected]> Cc: Alexander Duyck <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
ab41ee6879
commit
af3b854492
2 changed files with 9 additions and 2 deletions
|
|
@ -3131,7 +3131,7 @@ static int __init setup_fail_page_alloc(char *str)
|
|||
}
|
||||
__setup("fail_page_alloc=", setup_fail_page_alloc);
|
||||
|
||||
static bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
|
||||
static bool __should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
|
||||
{
|
||||
if (order < fail_page_alloc.min_order)
|
||||
return false;
|
||||
|
|
@ -3181,13 +3181,19 @@ late_initcall(fail_page_alloc_debugfs);
|
|||
|
||||
#else /* CONFIG_FAIL_PAGE_ALLOC */
|
||||
|
||||
static inline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
|
||||
static inline bool __should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_FAIL_PAGE_ALLOC */
|
||||
|
||||
static noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order)
|
||||
{
|
||||
return __should_fail_alloc_page(gfp_mask, order);
|
||||
}
|
||||
ALLOW_ERROR_INJECTION(should_fail_alloc_page, TRUE);
|
||||
|
||||
/*
|
||||
* Return true if free base pages are above 'mark'. For high-order checks it
|
||||
* will return true of the order-0 watermark is reached and there is at least
|
||||
|
|
|
|||
Loading…
Reference in a new issue