diff options
Diffstat (limited to 'lib/xarray.c')
-rw-r--r-- | lib/xarray.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/xarray.c b/lib/xarray.c index 6be3acbb861f..446b956c9188 100644 --- a/lib/xarray.c +++ b/lib/xarray.c | |||
@@ -298,6 +298,8 @@ bool xas_nomem(struct xa_state *xas, gfp_t gfp) | |||
298 | xas_destroy(xas); | 298 | xas_destroy(xas); |
299 | return false; | 299 | return false; |
300 | } | 300 | } |
301 | if (xas->xa->xa_flags & XA_FLAGS_ACCOUNT) | ||
302 | gfp |= __GFP_ACCOUNT; | ||
301 | xas->xa_alloc = kmem_cache_alloc(radix_tree_node_cachep, gfp); | 303 | xas->xa_alloc = kmem_cache_alloc(radix_tree_node_cachep, gfp); |
302 | if (!xas->xa_alloc) | 304 | if (!xas->xa_alloc) |
303 | return false; | 305 | return false; |
@@ -325,6 +327,8 @@ static bool __xas_nomem(struct xa_state *xas, gfp_t gfp) | |||
325 | xas_destroy(xas); | 327 | xas_destroy(xas); |
326 | return false; | 328 | return false; |
327 | } | 329 | } |
330 | if (xas->xa->xa_flags & XA_FLAGS_ACCOUNT) | ||
331 | gfp |= __GFP_ACCOUNT; | ||
328 | if (gfpflags_allow_blocking(gfp)) { | 332 | if (gfpflags_allow_blocking(gfp)) { |
329 | xas_unlock_type(xas, lock_type); | 333 | xas_unlock_type(xas, lock_type); |
330 | xas->xa_alloc = kmem_cache_alloc(radix_tree_node_cachep, gfp); | 334 | xas->xa_alloc = kmem_cache_alloc(radix_tree_node_cachep, gfp); |
@@ -358,8 +362,12 @@ static void *xas_alloc(struct xa_state *xas, unsigned int shift) | |||
358 | if (node) { | 362 | if (node) { |
359 | xas->xa_alloc = NULL; | 363 | xas->xa_alloc = NULL; |
360 | } else { | 364 | } else { |
361 | node = kmem_cache_alloc(radix_tree_node_cachep, | 365 | gfp_t gfp = GFP_NOWAIT | __GFP_NOWARN; |
362 | GFP_NOWAIT | __GFP_NOWARN); | 366 | |
367 | if (xas->xa->xa_flags & XA_FLAGS_ACCOUNT) | ||
368 | gfp |= __GFP_ACCOUNT; | ||
369 | |||
370 | node = kmem_cache_alloc(radix_tree_node_cachep, gfp); | ||
363 | if (!node) { | 371 | if (!node) { |
364 | xas_set_err(xas, -ENOMEM); | 372 | xas_set_err(xas, -ENOMEM); |
365 | return NULL; | 373 | return NULL; |