mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-21 06:33:41 +00:00
69dd5a788f
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.37 Added: generic/hack-6.6/900-fix-build-to-handle-return-value.patch[1] Manually rebased: generic/pending-6.6/834-ledtrig-libata.patch Removed upstreamed: bcm27xx/patches-6.6/950-0398-drm-panel-panel-ilitek9881c-Use-cansleep-methods.patch[2] All other patches automatically rebased. 1. Patch suggested by @DragonBluep to circumvent upstream breakage of kernel 6.6.37 compilation. See comments in https://github.com/openwrt/openwrt/pull/15879 for additional discussion. 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.37&id=1618f7a875ffd916596392fd29880c0429b8af60 Build system: x86/64 Build-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia <therealgraysky@proton.me> Link: https://github.com/openwrt/openwrt/pull/15879 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
68 lines
2.5 KiB
Diff
68 lines
2.5 KiB
Diff
From 7b14f3444cf6b54b9905f2e7e1507e68fd92a9c0 Mon Sep 17 00:00:00 2001
|
|
From: David Plowman <david.plowman@raspberrypi.com>
|
|
Date: Tue, 29 Mar 2022 16:10:06 +0100
|
|
Subject: [PATCH 0359/1085] mm,page_alloc,cma: introduce a customisable
|
|
threshold for allocating pages in cma
|
|
|
|
On some platforms the cma area can be half the entire system memory,
|
|
meaning that allocations start happening in the cma area immediately.
|
|
This leads to fragmentation and subsequent fatal cma_alloc failures.
|
|
|
|
We introduce an "alloc_in_cma_threshold" parameter which requires that
|
|
this many sixteenths of the free pages must be in cma before it will
|
|
try to use them. By default this is set to 12, but the previous
|
|
behaviour can be restored by setting it to 8 on startup.
|
|
|
|
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
|
|
---
|
|
mm/page_alloc.c | 28 +++++++++++++++++++++++++---
|
|
1 file changed, 25 insertions(+), 3 deletions(-)
|
|
|
|
--- a/mm/page_alloc.c
|
|
+++ b/mm/page_alloc.c
|
|
@@ -204,6 +204,27 @@ EXPORT_SYMBOL(node_states);
|
|
|
|
gfp_t gfp_allowed_mask __read_mostly = GFP_BOOT_MASK;
|
|
|
|
+#define ALLOC_IN_CMA_THRESHOLD_MAX 16
|
|
+#define ALLOC_IN_CMA_THRESHOLD_DEFAULT 12
|
|
+
|
|
+static unsigned long _alloc_in_cma_threshold __read_mostly
|
|
+ = ALLOC_IN_CMA_THRESHOLD_DEFAULT;
|
|
+
|
|
+static int __init alloc_in_cma_threshold_setup(char *buf)
|
|
+{
|
|
+ unsigned long res;
|
|
+
|
|
+ if (kstrtoul(buf, 10, &res) < 0 ||
|
|
+ res > ALLOC_IN_CMA_THRESHOLD_MAX) {
|
|
+ pr_err("Bad alloc_cma_threshold value\n");
|
|
+ return 0;
|
|
+ }
|
|
+ _alloc_in_cma_threshold = res;
|
|
+ pr_info("Setting alloc_in_cma_threshold to %lu\n", res);
|
|
+ return 0;
|
|
+}
|
|
+early_param("alloc_in_cma_threshold", alloc_in_cma_threshold_setup);
|
|
+
|
|
/*
|
|
* A cached value of the page's pageblock's migratetype, used when the page is
|
|
* put on a pcplist. Used to avoid the pageblock migratetype lookup when
|
|
@@ -2095,12 +2116,13 @@ __rmqueue(struct zone *zone, unsigned in
|
|
if (IS_ENABLED(CONFIG_CMA)) {
|
|
/*
|
|
* Balance movable allocations between regular and CMA areas by
|
|
- * allocating from CMA when over half of the zone's free memory
|
|
- * is in the CMA area.
|
|
+ * allocating from CMA when over more than a given proportion of
|
|
+ * the zone's free memory is in the CMA area.
|
|
*/
|
|
if (alloc_flags & ALLOC_CMA &&
|
|
zone_page_state(zone, NR_FREE_CMA_PAGES) >
|
|
- zone_page_state(zone, NR_FREE_PAGES) / 2) {
|
|
+ zone_page_state(zone, NR_FREE_PAGES) / ALLOC_IN_CMA_THRESHOLD_MAX
|
|
+ * _alloc_in_cma_threshold) {
|
|
page = __rmqueue_cma_fallback(zone, order);
|
|
if (page)
|
|
return page;
|