mirror of https://github.com/xemu-project/xemu.git
memory: introduce total_dirty_pages to stat dirty pages
introduce global var total_dirty_pages to stat dirty pages along with memory_global_dirty_log_sync. Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn> Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
6fee3a1fd9
commit
4998a37e4b
|
@ -26,6 +26,8 @@
|
||||||
#include "exec/ramlist.h"
|
#include "exec/ramlist.h"
|
||||||
#include "exec/ramblock.h"
|
#include "exec/ramblock.h"
|
||||||
|
|
||||||
|
extern uint64_t total_dirty_pages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clear_bmap_size: calculate clear bitmap size
|
* clear_bmap_size: calculate clear bitmap size
|
||||||
*
|
*
|
||||||
|
@ -373,6 +375,10 @@ static inline void cpu_physical_memory_set_dirty_lebitmap(unsigned long *bitmap,
|
||||||
qatomic_or(
|
qatomic_or(
|
||||||
&blocks[DIRTY_MEMORY_MIGRATION][idx][offset],
|
&blocks[DIRTY_MEMORY_MIGRATION][idx][offset],
|
||||||
temp);
|
temp);
|
||||||
|
if (unlikely(
|
||||||
|
global_dirty_tracking & GLOBAL_DIRTY_DIRTY_RATE)) {
|
||||||
|
total_dirty_pages += ctpopl(temp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tcg_enabled()) {
|
if (tcg_enabled()) {
|
||||||
|
@ -403,6 +409,9 @@ static inline void cpu_physical_memory_set_dirty_lebitmap(unsigned long *bitmap,
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
if (bitmap[i] != 0) {
|
if (bitmap[i] != 0) {
|
||||||
c = leul_to_cpu(bitmap[i]);
|
c = leul_to_cpu(bitmap[i]);
|
||||||
|
if (unlikely(global_dirty_tracking & GLOBAL_DIRTY_DIRTY_RATE)) {
|
||||||
|
total_dirty_pages += ctpopl(c);
|
||||||
|
}
|
||||||
do {
|
do {
|
||||||
j = ctzl(c);
|
j = ctzl(c);
|
||||||
c &= ~(1ul << j);
|
c &= ~(1ul << j);
|
||||||
|
|
|
@ -28,6 +28,13 @@
|
||||||
#include "sysemu/runstate.h"
|
#include "sysemu/runstate.h"
|
||||||
#include "exec/memory.h"
|
#include "exec/memory.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* total_dirty_pages is procted by BQL and is used
|
||||||
|
* to stat dirty pages during the period of two
|
||||||
|
* memory_global_dirty_log_sync
|
||||||
|
*/
|
||||||
|
uint64_t total_dirty_pages;
|
||||||
|
|
||||||
typedef struct DirtyPageRecord {
|
typedef struct DirtyPageRecord {
|
||||||
uint64_t start_pages;
|
uint64_t start_pages;
|
||||||
uint64_t end_pages;
|
uint64_t end_pages;
|
||||||
|
|
Loading…
Reference in New Issue