[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v7 1/3] migration/dirtyrate: implement vCPU dirtyrate calcula

From: Hyman Huang
Subject: Re: [PATCH v7 1/3] migration/dirtyrate: implement vCPU dirtyrate calculation periodically
Date: Tue, 30 Nov 2021 23:10:30 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0

On 11/30/21 21:04, Peter Xu wrote:
On Tue, Nov 30, 2021 at 06:28:11PM +0800, huangy81@chinatelecom.cn wrote:
+static void dirtylimit_calc_func(void)
+    CPUState *cpu;
+    DirtyPageRecord *dirty_pages;
+    int64_t start_time, end_time, calc_time;
+    DirtyRateVcpu rate;
+    int i = 0;
+    dirty_pages = g_malloc0(sizeof(*dirty_pages) *
+        dirtylimit_calc_state->data.nvcpu);
+    dirtylimit_global_dirty_log_start();
+    CPU_FOREACH(cpu) {
+        record_dirtypages(dirty_pages, cpu, true);
+    }
+    start_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
+    g_usleep(DIRTYLIMIT_CALC_TIME_MS * 1000);
+    end_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME);
+    calc_time = end_time - start_time;
+    dirtylimit_global_dirty_log_stop();

I haven't looked into the details, but..  I'm wondering whether we should just
keep the dirty ring enabled during the whole process of throttling.

start/stop can be expensive, especially when huge pages are used, start dirty
tracking will start to do huge page split. While right after the "stop" all the
huge pages will need to be rebuild again.

David from Google is even proposing a kernel change to eagerly splitting huge
pages when dirty tracking is enabled.

So I think we can keep the dirty tracking enabled until all the vcpu throttles
are stopped.
Yes, it's a good idea and i'll try this out next version.

+    CPU_FOREACH(cpu) {
+        record_dirtypages(dirty_pages, cpu, false);
+    }

Best Regards
Hyman Huang(黄勇)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]