summaryrefslogtreecommitdiff
path: root/lib/xarray.c
diff options
context:
space:
mode:
authorJoel Stanley <joel@jms.id.au>2019-07-04 04:43:37 +0300
committerJoel Stanley <joel@jms.id.au>2019-07-04 04:43:41 +0300
commit2caf12c9ed84a39b383d0f237d1506b7e9a95bdf (patch)
tree8ba503d4cb7079f73d4b71f306c3e0c120cec53b /lib/xarray.c
parentd83aec28b086ee676056638d77ac93b06ec3d4b1 (diff)
parent8584aaf1c3262ca17d1e4a614ede9179ef462bb0 (diff)
downloadlinux-dev-5.1.tar.xz
Merge tag 'v5.1.16' into dev-5.1dev-5.1
This is the 5.1.16 stable release Signed-off-by: Joel Stanley <joel@jms.id.au>
Diffstat (limited to 'lib/xarray.c')
-rw-r--r--lib/xarray.c12
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;