linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Liangcai Fan <liangcaifan19@gmail.com>
To: liangcai.fan@unisoc.com, akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	zhang.lyra@gmail.com, Liangcai Fan <liangcaifan19@gmail.com>
Subject: [PATCH] mm: Set min_free_kbytes with user_min_free_kbytes when user_min_free_kbytes is preferred
Date: Tue, 28 Sep 2021 20:23:17 +0800	[thread overview]
Message-ID: <1632831797-32192-1-git-send-email-liangcaifan19@gmail.com> (raw)

The 'min_free_kbytes' and 'user_min_free_kbytes' maybe inconsistent
after a few times of memory hotplug.
When 'new_min_free_kbytes' is not larger than 'user_min_free_kbytes',
set 'min_free_kbytes' with 'user_min_free_kbytes' rather than leave
it as the 'new_min_free_kbytes' calculated for the last time.

Signed-off-by: Liangcai Fan <liangcaifan19@gmail.com>
Cc: Chunyan Zhang <zhang.lyra@gmail.com>
---
 mm/page_alloc.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index b37435c..ddf9dc1 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -8467,6 +8467,12 @@ int __meminit init_per_zone_wmark_min(void)
 		if (min_free_kbytes > 262144)
 			min_free_kbytes = 262144;
 	} else {
+		/*
+		 * Set 'min_free_kbytes' with 'user_min_free_kbytes' rather than
+		 * leave it as the 'new_min_free_kbytes' calculated for the last
+		 * time.
+		 */
+		min_free_kbytes = user_min_free_kbytes;
 		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);
 	}
-- 
1.9.1



             reply	other threads:[~2021-09-28 12:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-28 12:23 Liangcai Fan [this message]
2021-09-28 22:29 ` Andrew Morton
2021-09-29  6:15   ` Fan Liangcai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1632831797-32192-1-git-send-email-liangcaifan19@gmail.com \
    --to=liangcaifan19@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=liangcai.fan@unisoc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=zhang.lyra@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox