diff options
Diffstat (limited to 'lib/radix-tree.c')
-rw-r--r-- | lib/radix-tree.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/radix-tree.c b/lib/radix-tree.c index 61b8fb529cef..1b7bf7314141 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c | |||
@@ -277,10 +277,11 @@ radix_tree_node_alloc(struct radix_tree_root *root) | |||
277 | 277 | ||
278 | /* | 278 | /* |
279 | * Even if the caller has preloaded, try to allocate from the | 279 | * Even if the caller has preloaded, try to allocate from the |
280 | * cache first for the new node to get accounted. | 280 | * cache first for the new node to get accounted to the memory |
281 | * cgroup. | ||
281 | */ | 282 | */ |
282 | ret = kmem_cache_alloc(radix_tree_node_cachep, | 283 | ret = kmem_cache_alloc(radix_tree_node_cachep, |
283 | gfp_mask | __GFP_ACCOUNT | __GFP_NOWARN); | 284 | gfp_mask | __GFP_NOWARN); |
284 | if (ret) | 285 | if (ret) |
285 | goto out; | 286 | goto out; |
286 | 287 | ||
@@ -303,8 +304,7 @@ radix_tree_node_alloc(struct radix_tree_root *root) | |||
303 | kmemleak_update_trace(ret); | 304 | kmemleak_update_trace(ret); |
304 | goto out; | 305 | goto out; |
305 | } | 306 | } |
306 | ret = kmem_cache_alloc(radix_tree_node_cachep, | 307 | ret = kmem_cache_alloc(radix_tree_node_cachep, gfp_mask); |
307 | gfp_mask | __GFP_ACCOUNT); | ||
308 | out: | 308 | out: |
309 | BUG_ON(radix_tree_is_internal_node(ret)); | 309 | BUG_ON(radix_tree_is_internal_node(ret)); |
310 | return ret; | 310 | return ret; |
@@ -351,6 +351,12 @@ static int __radix_tree_preload(gfp_t gfp_mask, int nr) | |||
351 | struct radix_tree_node *node; | 351 | struct radix_tree_node *node; |
352 | int ret = -ENOMEM; | 352 | int ret = -ENOMEM; |
353 | 353 | ||
354 | /* | ||
355 | * Nodes preloaded by one cgroup can be be used by another cgroup, so | ||
356 | * they should never be accounted to any particular memory cgroup. | ||
357 | */ | ||
358 | gfp_mask &= ~__GFP_ACCOUNT; | ||
359 | |||
354 | preempt_disable(); | 360 | preempt_disable(); |
355 | rtp = this_cpu_ptr(&radix_tree_preloads); | 361 | rtp = this_cpu_ptr(&radix_tree_preloads); |
356 | while (rtp->nr < nr) { | 362 | while (rtp->nr < nr) { |