linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Xunlei Pang <xlpang@linux.alibaba.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Alexander Duyck <alexander.h.duyck@linux.intel.com>,
	Mel Gorman <mgorman@techsingularity.net>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Xunlei Pang <xlpang@linux.alibaba.com>
Subject: [PATCH 3/4] mm/page_reporting: Introduce "page_reporting_factor=" boot parameter
Date: Fri, 26 Mar 2021 17:44:57 +0800	[thread overview]
Message-ID: <1616751898-58393-4-git-send-email-xlpang@linux.alibaba.com> (raw)
In-Reply-To: <1616751898-58393-1-git-send-email-xlpang@linux.alibaba.com>

Currently the default behaviour(value 100) is to do full report,
although we can control it after boot via "page_reporting_factor"
sysfs knob, it could still be late because some amount of memory
has already been reported before operating this knob.

Sometimes we really want it safely off by default and turn it on
as needed at runtime, so "page_reporting_factor=" boot parameter
is that guarantee and meets different default setting requirements.

There's also a real-world problem that I noticed on tiny instances,
it always reports some memory at boot stage before application
starts and uses up memory which retriggers EPT fault after boot.

The following data(right after boot) indicates that 172032KiB pages
were unnecessarily reported and refault in:
 $ cat /sys/kernel/mm/page_reporting/refault_kbytes
 172032
 $ cat /sys/kernel/mm/page_reporting/reported_kbytes
 0

Thus it's reasonable to turn the page reporting off by default and
enable it at runtime as needed.

Signed-off-by: Xunlei Pang <xlpang@linux.alibaba.com>
---
 Documentation/admin-guide/kernel-parameters.txt |  3 +++
 mm/page_reporting.c                             | 13 +++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 0454572..46e296c 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -3524,6 +3524,9 @@
 			off: turn off poisoning (default)
 			on: turn on poisoning
 
+	page_reporting_factor= [KNL] Guest Free Page Reporting percentile.
+			[0, 100]: 0 - off, not report; 100 - default, full report.
+
 	panic=		[KNL] Kernel behaviour on panic: delay <timeout>
 			timeout > 0: seconds before rebooting
 			timeout = 0: wait forever
diff --git a/mm/page_reporting.c b/mm/page_reporting.c
index 86c6479..6ffedb8 100644
--- a/mm/page_reporting.c
+++ b/mm/page_reporting.c
@@ -524,3 +524,16 @@ static int __init page_reporting_init(void)
 }
 
 module_init(page_reporting_init);
+
+static int __init setup_reporting_factor(char *str)
+{
+	int v;
+
+	if (kstrtoint(str, 10, &v))
+		return -EINVAL;
+	if (v >= 0 && v <= 100)
+		reporting_factor = v;
+
+	return 0;
+}
+__setup("page_reporting_factor=", setup_reporting_factor);
-- 
1.8.3.1



  parent reply	other threads:[~2021-03-26  9:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-26  9:44 [PATCH 0/4] mm/page_reporting: Some knobs and fixes Xunlei Pang
2021-03-26  9:44 ` [PATCH 1/4] mm/page_reporting: Introduce free page reported counters Xunlei Pang
2021-04-02 18:29   ` Alexander Duyck
2021-03-26  9:44 ` [PATCH 2/4] mm/page_reporting: Introduce free page reporting factor Xunlei Pang
2021-04-02 18:56   ` Alexander Duyck
2021-04-06  6:53     ` Xunlei Pang
2021-03-26  9:44 ` Xunlei Pang [this message]
2021-03-26  9:44 ` [PATCH 4/4] mm/page_reporting: Fix possible user allocation failure Xunlei Pang
2021-04-02 19:55   ` Alexander Duyck
2021-04-06  6:55     ` Xunlei Pang
2021-04-02  4:08 ` [PATCH 0/4] mm/page_reporting: Some knobs and fixes Xunlei Pang
2021-04-02 18:17   ` Alexander Duyck

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=1616751898-58393-4-git-send-email-xlpang@linux.alibaba.com \
    --to=xlpang@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.h.duyck@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    /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