[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200624032712.23263-1-jsavitz@redhat.com>
Date: Tue, 23 Jun 2020 23:27:12 -0400
From: Joel Savitz <jsavitz@...hat.com>
To: linux-kernel@...r.kernel.org
Cc: Joel Savitz <jsavitz@...hat.com>, Vlastimil Babka <vbabka@...e.cz>,
John Hubbard <jhubbard@...dia.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Rafael Aquini <aquini@...hat.com>, linux-mm@...ck.org
Subject: [PATCH] mm/page_alloc: fix documentation error and remove magic numbers
When I increased the upper bound of the min_free_kbytes value in
ee8eb9a5fe863, I forgot to tweak the above comment to reflect
the new value. This patch fixes that mistake.
In addition, this patch replaces the magic number bounds with symbolic
constants to clarify the logic.
Suggested-by: John Hubbard <jhubbard@...dia.com>
Suggested-by: Vlastimil Babka <vbabka@...e.cz>
Signed-off-by: Joel Savitz <jsavitz@...hat.com>
---
mm/page_alloc.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 48eb0f1410d4..f725addc2748 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -7832,7 +7832,7 @@ 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
+ * we want it large (256MB 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:
@@ -7852,6 +7852,9 @@ void setup_per_zone_wmarks(void)
* 8192MB: 11584k
* 16384MB: 16384k
*/
+static const int MIN_FREE_KBYTES_LOWER_BOUND = 1 << 7;
+static const int MIN_FREE_KBYTES_UPPER_BOUND = 1 << 18;
+
int __meminit init_per_zone_wmark_min(void)
{
unsigned long lowmem_kbytes;
@@ -7862,10 +7865,10 @@ int __meminit init_per_zone_wmark_min(void)
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 > 262144)
- min_free_kbytes = 262144;
+ if (min_free_kbytes < MIN_FREE_KBYTES_LOWER_BOUND)
+ min_free_kbytes = MIN_FREE_KBYTES_LOWER_BOUND;
+ if (min_free_kbytes > MIN_FREE_KBYTES_UPPER_BOUND)
+ min_free_kbytes = MIN_FREE_KBYTES_UPPER_BOUND;
} 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);
--
2.23.0
Powered by blists - more mailing lists