[rh7] mm/slub: Don't compact memory for high-order optimistic allocation.

Submitted by Andrey Ryabinin on March 7, 2019, 4 p.m.

Details

Message ID 20190307160002.26808-1-aryabinin@virtuozzo.com
State New
Series "mm/slub: Don't compact memory for high-order optimistic allocation."
Headers show

Commit Message

Andrey Ryabinin March 7, 2019, 4 p.m.
Slub optimistically tries to allocate higher-then-necessary order
page first and than fallbacks to minimal order later. Even though
the first allocation is with __GFP_NORETRY it still slow if called
often under memory pressure, because it triggers direct compaction.

Remove __GFP_WAIT on the first try, so we don't go into direct compaction
and fallback to lower order sooner.

The patch will have little effect on latest kernels since we changed
default slub_max_order to zero, but it won't hurt to have it in case
someone changes slub_max_order.

https://pmc.acronis.com/browse/VSTOR-20830
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 mm/slub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/mm/slub.c b/mm/slub.c
index cfed91b0fdb8..7ea4138f96b6 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1440,7 +1440,7 @@  static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
 	 * Let the initial higher-order allocation fail under memory pressure
 	 * so we fall-back to the minimum order allocation.
 	 */
-	alloc_gfp = (flags | __GFP_NOWARN | __GFP_NORETRY) & ~__GFP_NOFAIL;
+	alloc_gfp = (flags | __GFP_NOWARN | __GFP_NORETRY) & ~(__GFP_NOFAIL|__GFP_WAIT);
 
 	page = alloc_slab_page(s, alloc_gfp, node, oo);
 	if (unlikely(!page)) {