summaryrefslogtreecommitdiff
path: root/tools/testing/radix-tree/linux.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-19 06:47:01 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-19 06:47:01 +0100
commit73709e1af5163ebf5e9b0e18fe90b7e843657d36 (patch)
tree91ca8b98187ba60e88f8df2e32147fdf651f159e /tools/testing/radix-tree/linux.c
parentc26dd817d99bc50acf2667ee27c39414a7a6638e (diff)
parentc698ca5278934c0ae32297a8725ced2e27585d7f (diff)
Merge 4.16-rc6 into staging-next
We want the staging fixes in here as well to handle merge/test issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/testing/radix-tree/linux.c')
-rw-r--r--tools/testing/radix-tree/linux.c11
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;
}