File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -7190,7 +7190,8 @@ struct page *try_alloc_pages_noprof(int nid, unsigned int order)
7190
7190
* specify it here to highlight that try_alloc_pages()
7191
7191
* doesn't want to deplete reserves.
7192
7192
*/
7193
- gfp_t alloc_gfp = __GFP_NOWARN | __GFP_ZERO | __GFP_NOMEMALLOC ;
7193
+ gfp_t alloc_gfp = __GFP_NOWARN | __GFP_ZERO | __GFP_NOMEMALLOC
7194
+ | __GFP_ACCOUNT ;
7194
7195
unsigned int alloc_flags = ALLOC_TRYLOCK ;
7195
7196
struct alloc_context ac = { };
7196
7197
struct page * page ;
@@ -7234,6 +7235,11 @@ struct page *try_alloc_pages_noprof(int nid, unsigned int order)
7234
7235
7235
7236
/* Unlike regular alloc_pages() there is no __alloc_pages_slowpath(). */
7236
7237
7238
+ if (memcg_kmem_online () && page &&
7239
+ unlikely (__memcg_kmem_charge_page (page , alloc_gfp , order ) != 0 )) {
7240
+ free_pages_nolock (page , order );
7241
+ page = NULL ;
7242
+ }
7237
7243
trace_mm_page_alloc (page , order , alloc_gfp , ac .migratetype );
7238
7244
kmsan_alloc_page (page , order , alloc_gfp );
7239
7245
return page ;
You can’t perform that action at this time.
0 commit comments