All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hyman Huang <huangy81@chinatelecom.cn>
To: Peter Xu <peterx@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>,
	Juan Quintela <quintela@redhat.com>,
	qemu-devel@nongnu.org,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Chuan Zheng <zhengchuan@huawei.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH 0/4] support dirtyrate measurement with dirty bitmap
Date: Sun, 11 Jul 2021 23:27:13 +0800	[thread overview]
Message-ID: <5ad1b7ce-1fb0-c551-8fe3-ed6fd3fab37c@chinatelecom.cn> (raw)
In-Reply-To: <YOiTYBITq1px8r1S@t490s>



在 2021/7/10 2:20, Peter Xu 写道:
> Yong,
> 
> On Sun, Jun 27, 2021 at 01:38:13PM +0800, huangy81@chinatelecom.cn wrote:
>> From: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
>>
>> the dirtyrate measurement implemented by page-sampling originally, it
>> is not accurate in some scenarios, so we have introduced dirty-ring
>> based dirtyrate measurement(maybe it will be merged soon), it fix the
>> accuracy of page-sampling, and more importantly, it is at the
>> granualrity of vcpu.
>>
>> dirty-ring method can be used when dirty-ring enable, as supplementary,
>> we introduce dirty-bitmap method to calculating dirtyrate when dirty log
>> enable, so that we can also get the accurate dirtyrate if needed in the
>> absence of dirty-ring.
>>
>> three things has done to implement the measurement:
>> - introduce a fresh new dirty bits named DIRTY_MEMORY_DIRTY_RATE, which
>>    is used to store dirty bitmap after fetching it from kvm. why we do
>>    not reuse the existing DIRTY_MEMORY_MIGRATION dirty bits is we do not
>>    want to interfere with migration of and let implementation clear, this
>>    is also the reason why dirty_memory be split.
>>
>>    DIRTY_MEMORY_DIRTY_RATE dirty bits will be filled when
>>    memory_global_dirty_log_sync executed if GLOBAL_DIRTY_DIRTY_RATE bit
>>    be set in the global_dirty_tracking flag.
> 
> I'm not 100% sure this is needed.
> 
> Dirty rate measurements do not care about which page is dirtied, it looks like
> an overkill to introduce a new bitmap for it.
indeed, dirty rate measurements only cares about the increased dirty 
pages number during calculation time.
> 
> IMHO we can directly do the calculation when synchronizing the dirty bits in
> below functions:
> 
>          cpu_physical_memory_set_dirty_range
>          cpu_physical_memory_set_dirty_lebitmap
>          cpu_physical_memory_sync_dirty_bitmap
> 
> Maybe we can define a global statistics for that?
uhhh... Do you mean that we can reuse the DIRTY_MEMORY_MIGRATION dirty 
bits to stat the new dirty pages number and just define the global var 
to count the increased dirty pages during the calculation time?
or we still use the bitmap but defined as a global var, instead of dirty 
bits?
> 
>>
>> - introduce kvm_get_manual_dirty_log_protect function so that we can
>>    probe the protect caps of kvm when calculating.
>>
>> - implement dirtyrate measurement with dirty bitmap with following step:
>>    1. start the dirty log.
>>
>>    2. probe the protect cap, if KVM_DIRTY_LOG_INITIALLY_SET enable, skip
>>       skip the 1'R and do the reset page protection manually, since kvm
>>       file bitmap with 1 bits if this cap is enabled.
>>
>>    3. clear the DIRTY_MEMORY_DIRTY_RATE dirty bits, prepare to store
>>       the dirty bitmap.
>>
>>    4. start memory_global_dirty_log_sync and fetch dirty bitmap from kvm
>>
>>    5. reap the DIRTY_MEMORY_DIRTY_RATE dirty bits and do the calculation.
>>
>> this patchset rebases on the commit
>> "migration/dirtyrate: implement dirty-ring dirtyrate calculation",
>> since the above feature has not been merged, so we post this patch
>> for the sake of RFC. ideally, this patshset may be merged after it.
> 
> I gave it a shot with some setup dirty workload, it runs well so far and also I
> do get accurate numbers (200MB/s measured as 201MB/s; 300MB/s measured as
> 301MB/s, and so on).  Looks good to me in general.
> 
> But as I mentioned above I feel like the changeset can be shrinked quite a bit
> if we can drop the extra bitmap; maybe it means we can drop half of the whole
> series.  But it's also possible I missed something, let's see.
> 
> It'll slightly differ from dirty ring in that same page written will always
> only be counted once between two dirty map sync, but that's expected.  Dirty
> ring "sync" more frequently (either ring full, or current 1-sec timeout in the
> reaper), so it re-protects more frequently too.
> 
> I still have some other small comments, I'll go into the patches.
> 
> Thanks,
> 

-- 
Best regard

Hyman Huang(黄勇)


  reply	other threads:[~2021-07-11 15:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-27  5:38 [PATCH 0/4] support dirtyrate measurement with dirty bitmap huangy81
     [not found] ` <cover.1624771216.git.huangy81@chinatelecom.cn>
2021-06-27  5:38   ` [PATCH 1/4] memory: introduce DIRTY_MEMORY_DIRTY_RATE dirty bits huangy81
2021-07-09 18:37     ` Peter Xu
2021-06-27  5:38   ` [PATCH 2/4] KVM: introduce kvm_get_manual_dirty_log_protect huangy81
2021-06-27  5:38   ` [PATCH 3/4] memory: introduce DIRTY_MEMORY_DIRTY_RATE dirty bits functions huangy81
2021-07-09 18:26     ` Peter Xu
2021-06-27  5:38   ` [PATCH 4/4] migration/dirtyrate: implement dirty-bitmap dirtyrate calculation huangy81
2021-07-09 18:32     ` Peter Xu
2021-07-09 18:20 ` [PATCH 0/4] support dirtyrate measurement with dirty bitmap Peter Xu
2021-07-11 15:27   ` Hyman Huang [this message]
2021-07-13 17:45     ` Peter Xu
2021-07-14 15:59       ` Hyman

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=5ad1b7ce-1fb0-c551-8fe3-ed6fd3fab37c@chinatelecom.cn \
    --to=huangy81@chinatelecom.cn \
    --cc=dgilbert@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=zhengchuan@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.