diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-02-26 13:22:45 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-02-26 13:22:45 -0800 |
commit | 6f70eb2b00eb416146247c65003d31f4df983ce0 (patch) | |
tree | 68baa0e3ce148b7fb845f15433c3207b358824f8 /tools/testing/radix-tree/linux.c | |
parent | 4c3579f6cadd5eb8250a36e789e6df66f660237a (diff) | |
parent | 4b0ad07653ee94182e2d8f21404242c9e83ad0b4 (diff) | |
download | linux-6f70eb2b00eb416146247c65003d31f4df983ce0.tar.bz2 |
Merge branch 'idr-2018-02-06' of git://git.infradead.org/users/willy/linux-dax
Pull idr fixes from Matthew Wilcox:
"One test-suite build fix for you and one run-time regression fix.
The regression fix includes new tests to make sure they don't pop back
up."
* 'idr-2018-02-06' of git://git.infradead.org/users/willy/linux-dax:
idr: Fix handling of IDs above INT_MAX
radix tree test suite: Fix build
Diffstat (limited to 'tools/testing/radix-tree/linux.c')
-rw-r--r-- | tools/testing/radix-tree/linux.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/testing/radix-tree/linux.c b/tools/testing/radix-tree/linux.c index 6903ccf35595..44a0d1ad4408 100644 --- a/tools/testing/radix-tree/linux.c +++ b/tools/testing/radix-tree/linux.c @@ -29,7 +29,7 @@ void *kmem_cache_alloc(struct kmem_cache *cachep, int flags) { struct radix_tree_node *node; - if (flags & __GFP_NOWARN) + if (!(flags & __GFP_DIRECT_RECLAIM)) return NULL; pthread_mutex_lock(&cachep->lock); @@ -73,10 +73,17 @@ void kmem_cache_free(struct kmem_cache *cachep, void *objp) void *kmalloc(size_t size, gfp_t gfp) { - void *ret = malloc(size); + void *ret; + + if (!(gfp & __GFP_DIRECT_RECLAIM)) + return NULL; + + ret = malloc(size); uatomic_inc(&nr_allocated); if (kmalloc_verbose) printf("Allocating %p from malloc\n", ret); + if (gfp & __GFP_ZERO) + memset(ret, 0, size); return ret; } |