Allocations can be a very hot path, and this out-of-line function
call is noticeable.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
struct kmem_cache;
-int should_failslab(struct kmem_cache *s, gfp_t gfpflags);
#ifdef CONFIG_FAILSLAB
+int should_failslab(struct kmem_cache *s, gfp_t gfpflags);
extern bool __should_failslab(struct kmem_cache *s, gfp_t gfpflags);
#else
static inline bool __should_failslab(struct kmem_cache *s, gfp_t gfpflags)
might_alloc(flags);
+#ifdef CONFIG_FAILSLAB
if (should_failslab(s, flags))
return NULL;
+#endif
if (!memcg_slab_pre_alloc_hook(s, objcgp, size, flags))
return NULL;
EXPORT_TRACEPOINT_SYMBOL(kfree);
EXPORT_TRACEPOINT_SYMBOL(kmem_cache_free);
+#ifdef CONFIG_FAILSLAB
int should_failslab(struct kmem_cache *s, gfp_t gfpflags)
{
if (__should_failslab(s, gfpflags))
return 0;
}
ALLOW_ERROR_INJECTION(should_failslab, ERRNO);
+#endif