It's set only in the main "else", so the declaration as well as the sole consumer can also move into that more narrow scope. This may in particular help with possible future locking changes.
Signed-off-by: Jan Beulich <[email protected]> --- a/xen/arch/x86/mm/shadow/hvm.c +++ b/xen/arch/x86/mm/shadow/hvm.c @@ -1022,7 +1022,6 @@ int shadow_track_dirty_vram(struct domai int rc = 0; unsigned long end_pfn = begin_pfn + nr_frames; unsigned int dirty_size = DIV_ROUND_UP(nr_frames, BITS_PER_BYTE); - int flush_tlb = 0; unsigned long i; p2m_type_t t; struct sh_dirty_vram *dirty_vram; @@ -1097,7 +1096,7 @@ int shadow_track_dirty_vram(struct domai { mfn_t map_mfn = INVALID_MFN; void *map_sl1p = NULL; - bool any_dirty = false; + bool any_dirty = false, flush_tlb = false; s_time_t now; /* Iterate over VRAM to track dirty bits. */ @@ -1158,7 +1157,7 @@ int shadow_track_dirty_vram(struct domai * _PAGE_ACCESSED set by another processor. */ l1e_remove_flags(*sl1e, _PAGE_DIRTY); - flush_tlb = 1; + flush_tlb = true; } } break; @@ -1201,9 +1200,10 @@ int shadow_track_dirty_vram(struct domai } dirty_vram->last_dirty = -1; } + + if ( flush_tlb ) + guest_flush_tlb_mask(d, d->dirty_cpumask); } - if ( flush_tlb ) - guest_flush_tlb_mask(d, d->dirty_cpumask); goto out; out_sl1ma:
