diff options
| author | Jason Gunthorpe <jgg@mellanox.com> | 2019-07-02 14:34:43 -0300 |
|---|---|---|
| committer | Jason Gunthorpe <jgg@mellanox.com> | 2019-07-02 14:34:43 -0300 |
| commit | 9ec3f4cb35bc8278f0582fed9f9229c9315c2ffb (patch) | |
| tree | 3ff6a17a33913268a2ed06e7d9a1a95e29eeee97 /lib/xarray.c | |
| parent | c5d6c45e90c49150670346967971e14576afd7f1 (diff) | |
| parent | 6fbc7275c7a9ba97877050335f290341a1fd8dbf (diff) | |
Merge tag 'v5.2-rc7' into rdma.git hmm
Required for dependencies in the next patches.
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) 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; |
