Re: [PATCH v2 04/16] KVM: MMU: return bool in __rmap_write_protect

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

 



On Sun, 15 Apr 2012 14:25:30 +0300
Avi Kivity <avi@xxxxxxxxxx> wrote:

> > > @@ -1689,7 +1690,7 @@ static void mmu_sync_children(struct kvm_vcpu *vcpu,
> > > 
> > >  	kvm_mmu_pages_init(parent, &parents, &pages);
> > >  	while (mmu_unsync_walk(parent, &pages)) {
> > > -		int protected = 0;
> > > +		bool protected = false;
> > > 
> > >  		for_each_sp(pages, sp, parents, i)
> > >  			protected |= rmap_write_protect(vcpu->kvm, sp->gfn);
> >
> > Isn't this the reason we prefer int to bool?
> >
> > Not sure people like to use |= with boolean.
> >
> 
> Why not?
> 

The code "bitwise OR assignment" is assuming the internal representations
of true and false: true=1, false=0.

I might have seen some point if it had been
	protected = protected || rmap_...


But the real question is whether there is any point in re-writing completely
correct C code: there are tons of int like this in the kernel code.

__rmap_write_protect() was introduced recently, so if this conversion is
really worthwhile, I should have been told to use bool at that time, no?


Thanks,
	Takuya
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux