ARCv2: entry: rewrite to enable use of double load/stores LDD/STD
[linux-2.6-microblaze.git] / lib / xarray.c
index 6be3acb..446b956 100644 (file)
@@ -298,6 +298,8 @@ bool xas_nomem(struct xa_state *xas, gfp_t gfp)
                xas_destroy(xas);
                return false;
        }
+       if (xas->xa->xa_flags & XA_FLAGS_ACCOUNT)
+               gfp |= __GFP_ACCOUNT;
        xas->xa_alloc = kmem_cache_alloc(radix_tree_node_cachep, gfp);
        if (!xas->xa_alloc)
                return false;
@@ -325,6 +327,8 @@ static bool __xas_nomem(struct xa_state *xas, gfp_t gfp)
                xas_destroy(xas);
                return false;
        }
+       if (xas->xa->xa_flags & XA_FLAGS_ACCOUNT)
+               gfp |= __GFP_ACCOUNT;
        if (gfpflags_allow_blocking(gfp)) {
                xas_unlock_type(xas, lock_type);
                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)
        if (node) {
                xas->xa_alloc = NULL;
        } else {
-               node = kmem_cache_alloc(radix_tree_node_cachep,
-                                       GFP_NOWAIT | __GFP_NOWARN);
+               gfp_t gfp = GFP_NOWAIT | __GFP_NOWARN;
+
+               if (xas->xa->xa_flags & XA_FLAGS_ACCOUNT)
+                       gfp |= __GFP_ACCOUNT;
+
+               node = kmem_cache_alloc(radix_tree_node_cachep, gfp);
                if (!node) {
                        xas_set_err(xas, -ENOMEM);
                        return NULL;