[Devel] [PATCH RHEL7 COMMIT] mm/slub: Don't compact memory for high-order optimistic allocation.

Konstantin Khorenko khorenko at virtuozzo.com
Mon Mar 11 18:29:04 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.5.1.vz7.84.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.5.1.vz7.84.5
------>
commit 24b32402cd5002b6163325b3a3438d208e410261
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date:   Mon Mar 11 18:29:01 2019 +0300

    mm/slub: Don't compact memory for high-order optimistic allocation.
    
    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 at virtuozzo.com>
---
 mm/slub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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)) {



More information about the Devel mailing list