Add __GFP_MIRROR flag when allocate a new slab. Signed-off-by: Xishi Qiu <qiuxishi@xxxxxxxxxx> --- mm/slab.c | 3 ++- mm/slob.c | 2 +- mm/slub.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mm/slab.c b/mm/slab.c index 7eb38dd..3b3ef22 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -1594,7 +1594,8 @@ static struct page *kmem_getpages(struct kmem_cache *cachep, gfp_t flags, if (memcg_charge_slab(cachep, flags, cachep->gfporder)) return NULL; - page = alloc_pages_exact_node(nodeid, flags | __GFP_NOTRACK, cachep->gfporder); + page = alloc_pages_exact_node(nodeid, flags | __GFP_NOTRACK | __GFP_MIRROR, + cachep->gfporder); if (!page) { memcg_uncharge_slab(cachep, cachep->gfporder); slab_out_of_memory(cachep, flags, nodeid); diff --git a/mm/slob.c b/mm/slob.c index 4765f65..4ff9bde 100644 --- a/mm/slob.c +++ b/mm/slob.c @@ -452,7 +452,7 @@ __do_kmalloc_node(size_t size, gfp_t gfp, int node, unsigned long caller) if (likely(order)) gfp |= __GFP_COMP; - ret = slob_new_pages(gfp, order, node); + ret = slob_new_pages(gfp | __GFP_MIRROR, order, node); trace_kmalloc_node(caller, ret, size, PAGE_SIZE << order, gfp, node); diff --git a/mm/slub.c b/mm/slub.c index 54c0876..1219e33 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1315,7 +1315,7 @@ static inline struct page *alloc_slab_page(struct kmem_cache *s, struct page *page; int order = oo_order(oo); - flags |= __GFP_NOTRACK; + flags |= __GFP_NOTRACK | __GFP_MIRROR; if (memcg_charge_slab(s, flags, order)) return NULL; -- 2.0.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>