diff options
Diffstat (limited to '0017-ZEN-mm-Lower-the-non-hugetlbpage-pageblock-size-to-r.patch')
-rw-r--r-- | 0017-ZEN-mm-Lower-the-non-hugetlbpage-pageblock-size-to-r.patch | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/0017-ZEN-mm-Lower-the-non-hugetlbpage-pageblock-size-to-r.patch b/0017-ZEN-mm-Lower-the-non-hugetlbpage-pageblock-size-to-r.patch new file mode 100644 index 000000000000..11b98001f453 --- /dev/null +++ b/0017-ZEN-mm-Lower-the-non-hugetlbpage-pageblock-size-to-r.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Sultan Alsawaf <sultan@kerneltoast.com> +Date: Wed, 20 Oct 2021 20:50:11 -0700 +Subject: [PATCH] ZEN: mm: Lower the non-hugetlbpage pageblock size to reduce + scheduling delays + +The page allocator processes free pages in groups of pageblocks, where +the size of a pageblock is typically quite large (1024 pages without +hugetlbpage support). Pageblocks are processed atomically with the zone +lock held, which can cause severe scheduling delays on both the CPU +going through the pageblock and any other CPUs waiting to acquire the +zone lock. A frequent offender is move_freepages_block(), which is used +by rmqueue() for page allocation. + +As it turns out, there's no requirement for pageblocks to be so large, +so the pageblock order can simply be reduced to ease the scheduling +delays and zone lock contention. PAGE_ALLOC_COSTLY_ORDER is used as a +reasonable setting to ensure non-costly page allocation requests can +still be serviced without always needing to free up more than one +pageblock's worth of pages at a time. + +This has a noticeable effect on overall system latency when memory +pressure is elevated. The various mm functions which operate on +pageblocks no longer appear in the preemptoff tracer, where previously +they would spend up to 100 ms on a mobile arm64 CPU processing a +pageblock with preemption disabled and the zone lock held. + +Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com> +--- + include/linux/pageblock-flags.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h +index 83c7248053a1eb745e0bff410be66d0f04a5e8bb..d2b8741eabf7e01802dbb0705a12cb2e5c80ea1d 100644 +--- a/include/linux/pageblock-flags.h ++++ b/include/linux/pageblock-flags.h +@@ -48,7 +48,7 @@ extern unsigned int pageblock_order; + #else /* CONFIG_HUGETLB_PAGE */ + + /* If huge pages are not used, group by MAX_ORDER_NR_PAGES */ +-#define pageblock_order (MAX_ORDER-1) ++#define pageblock_order PAGE_ALLOC_COSTLY_ORDER + + #endif /* CONFIG_HUGETLB_PAGE */ + |