[Devel] [PATCH RHEL7 COMMIT] Revert "mm: Change formula of calculation of default min_free_kbytes"
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Jun 14 16:20:36 MSK 2019
The commit is pushed to "branch-rh7-3.10.0-957.21.2.vz7.105.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.21.2.vz7.97.1
------>
commit ab2fb6a114f12a9b0b65679c22274cc4951f6ba7
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date: Fri Jun 14 16:14:49 2019 +0300
Revert "mm: Change formula of calculation of default min_free_kbytes"
This reverts commit 484ef163ae0ca343eb4c8bd09c2f4ad968d763d2.
We've enhanced algorithm of kswapd aggressiveness in the scope of
https://jira.sw.ru/browse/PSBM-94102,
so need to return back the default min_free_kbytes calcumation formula.
https://pmc.acronis.com/browse/VSTOR-24141
https://pmc.acronis.com/browse/VSTOR-21390
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
mm/page_alloc.c | 27 ++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 50b761c9ce10..78c68ba512e9 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6830,6 +6830,27 @@ void setup_per_zone_wmarks(void)
/*
* Initialise min_free_kbytes.
+ *
+ * For small machines we want it small (128k min). For large machines
+ * we want it large (64MB max). But it is not linear, because network
+ * bandwidth does not increase linearly with machine size. We use
+ *
+ * min_free_kbytes = 4 * sqrt(lowmem_kbytes), for better accuracy:
+ * min_free_kbytes = sqrt(lowmem_kbytes * 16)
+ *
+ * which yields
+ *
+ * 16MB: 512k
+ * 32MB: 724k
+ * 64MB: 1024k
+ * 128MB: 1448k
+ * 256MB: 2048k
+ * 512MB: 2896k
+ * 1024MB: 4096k
+ * 2048MB: 5792k
+ * 4096MB: 8192k
+ * 8192MB: 11584k
+ * 16384MB: 16384k
*/
int __meminit init_per_zone_wmark_min(void)
{
@@ -6837,14 +6858,14 @@ int __meminit init_per_zone_wmark_min(void)
int new_min_free_kbytes;
lowmem_kbytes = nr_free_buffer_pages() * (PAGE_SIZE >> 10);
- new_min_free_kbytes = lowmem_kbytes * 2 / 100; /* 2% */
+ new_min_free_kbytes = int_sqrt(lowmem_kbytes * 16);
if (new_min_free_kbytes > user_min_free_kbytes) {
min_free_kbytes = new_min_free_kbytes;
if (min_free_kbytes < 128)
min_free_kbytes = 128;
- if (min_free_kbytes > 4194304)
- min_free_kbytes = 4194304;
+ if (min_free_kbytes > 65536)
+ min_free_kbytes = 65536;
} else {
pr_warn("min_free_kbytes is not updated to %d because user defined value %d is preferred\n",
new_min_free_kbytes, user_min_free_kbytes);
More information about the Devel
mailing list