aboutsummaryrefslogtreecommitdiff
path: root/migration/dirtyrate.h
diff options
context:
space:
mode:
authorHyman Huang(黄勇) <huangy81@chinatelecom.cn>2021-06-07 09:11:34 +0800
committerDr. David Alan Gilbert <dgilbert@redhat.com>2021-06-08 20:18:25 +0100
commit7afa08cd8fd2e5016658c39f6eb327e92edf0612 (patch)
treeab63a6bdb88414e3bbf1dff7eba9127a175e5312 /migration/dirtyrate.h
parent8bd1078aebcec5eac196a83ef1a7e74be0ba67b7 (diff)
migration/dirtyrate: make sample page count configurable
introduce optional sample-pages argument in calc-dirty-rate, making sample page count per GB configurable so that more accurate dirtyrate can be calculated. Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn> Message-Id: <3103453a3b2796f929269c99a6ad81a9a7f1f405.1623027729.git.huangy81@chinatelecom.cn> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Wrapped a couple of long lines
Diffstat (limited to 'migration/dirtyrate.h')
-rw-r--r--migration/dirtyrate.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/migration/dirtyrate.h b/migration/dirtyrate.h
index 6ec429534d..e1fd29089e 100644
--- a/migration/dirtyrate.h
+++ b/migration/dirtyrate.h
@@ -15,7 +15,6 @@
/*
* Sample 512 pages per GB as default.
- * TODO: Make it configurable.
*/
#define DIRTYRATE_DEFAULT_SAMPLE_PAGES 512
@@ -35,6 +34,12 @@
#define MIN_FETCH_DIRTYRATE_TIME_SEC 1
#define MAX_FETCH_DIRTYRATE_TIME_SEC 60
+/*
+ * Take 1/16 pages in 1G as the maxmum sample page count
+ */
+#define MIN_SAMPLE_PAGE_COUNT 128
+#define MAX_SAMPLE_PAGE_COUNT 16384
+
struct DirtyRateConfig {
uint64_t sample_pages_per_gigabytes; /* sample pages per GB */
int64_t sample_period_seconds; /* time duration between two sampling */
@@ -63,6 +68,7 @@ struct DirtyRateStat {
int64_t dirty_rate; /* dirty rate in MB/s */
int64_t start_time; /* calculation start time in units of second */
int64_t calc_time; /* time duration of two sampling in units of second */
+ uint64_t sample_pages; /* sample pages per GB */
};
void *get_dirtyrate_thread(void *arg);