Skip to content

Commit 8dcb306

Browse files
shakeelbtorvalds
authored andcommitted
memcg: page_alloc: skip bulk allocator for __GFP_ACCOUNT
Commit 5c1f4e6 ("mm/vmalloc: switch to bulk allocator in __vmalloc_area_node()") switched to bulk page allocator for order 0 allocation backing vmalloc. However bulk page allocator does not support __GFP_ACCOUNT allocations and there are several users of kvmalloc(__GFP_ACCOUNT). For now make __GFP_ACCOUNT allocations bypass bulk page allocator. In future if there is workload that can be significantly improved with the bulk page allocator with __GFP_ACCCOUNT support, we can revisit the decision. Link: https://lkml.kernel.org/r/[email protected] Fixes: 5c1f4e6 ("mm/vmalloc: switch to bulk allocator in __vmalloc_area_node()") Signed-off-by: Shakeel Butt <[email protected]> Reported-by: Vasily Averin <[email protected]> Tested-by: Vasily Averin <[email protected]> Acked-by: David Hildenbrand <[email protected]> Acked-by: Michal Hocko <[email protected]> Acked-by: Roman Gushchin <[email protected]> Acked-by: Johannes Weiner <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 411a44c commit 8dcb306

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mm/page_alloc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5223,6 +5223,10 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid,
52235223
if (unlikely(page_array && nr_pages - nr_populated == 0))
52245224
goto out;
52255225

5226+
/* Bulk allocator does not support memcg accounting. */
5227+
if (memcg_kmem_enabled() && (gfp & __GFP_ACCOUNT))
5228+
goto failed;
5229+
52265230
/* Use the single page allocator for one page. */
52275231
if (nr_pages - nr_populated == 1)
52285232
goto failed;

0 commit comments

Comments
 (0)