diff options
author | Matthew Wilcox <willy@linux.intel.com> | 2016-12-14 18:07:59 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-14 19:04:09 -0500 |
commit | 31023cd66468359790beb046b6808fe0444672a2 (patch) | |
tree | 55cee431758d32ae93f14b444ac33618bcd8f8b6 /tools/testing/radix-tree/linux.c | |
parent | ebb9a9aedb95f697673a96a26ff0322a13676381 (diff) |
radix tree test suite: allow GFP_ATOMIC allocations to fail
In order to test the preload code, it is necessary to fail GFP_ATOMIC
allocations, which requires defining GFP_KERNEL and GFP_ATOMIC properly.
Remove the obsolete __GFP_WAIT and copy the definitions of the __GFP
flags which are used from the kernel include files. We also need the
real definition of gfpflags_allow_blocking() to persuade the radix tree
to actually use its preallocated nodes.
Link: http://lkml.kernel.org/r/1480369871-5271-38-git-send-email-mawilcox@linuxonhyperv.com
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'tools/testing/radix-tree/linux.c')
-rw-r--r-- | tools/testing/radix-tree/linux.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/testing/radix-tree/linux.c b/tools/testing/radix-tree/linux.c index 154823737b20..3cfb04e98e2f 100644 --- a/tools/testing/radix-tree/linux.c +++ b/tools/testing/radix-tree/linux.c | |||
@@ -33,7 +33,12 @@ mempool_t *mempool_create(int min_nr, mempool_alloc_t *alloc_fn, | |||
33 | 33 | ||
34 | void *kmem_cache_alloc(struct kmem_cache *cachep, int flags) | 34 | void *kmem_cache_alloc(struct kmem_cache *cachep, int flags) |
35 | { | 35 | { |
36 | void *ret = malloc(cachep->size); | 36 | void *ret; |
37 | |||
38 | if (flags & __GFP_NOWARN) | ||
39 | return NULL; | ||
40 | |||
41 | ret = malloc(cachep->size); | ||
37 | if (cachep->ctor) | 42 | if (cachep->ctor) |
38 | cachep->ctor(ret); | 43 | cachep->ctor(ret); |
39 | uatomic_inc(&nr_allocated); | 44 | uatomic_inc(&nr_allocated); |