[Devel] [PATCH rh7] mm/slub: Don't compact memory for high-order optimistic allocation.
Andrey Ryabinin
aryabinin at virtuozzo.com
Thu Mar 7 19:00:02 MSK 2019
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)) {
--
2.19.2
More information about the Devel
mailing list