Re: [PATCH] KVM: x86: small optimization for is_mtrr_mask calculation

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

 



Hi,
Paolo Bonzini <pbonzini@xxxxxxxxxx> wrote:
>On 05/03/20 03:48, linmiaohe wrote:
>> From: Miaohe Lin <linmiaohe@xxxxxxxxxx>
>> 
>> We can get is_mtrr_mask by calculating (msr - 0x200) % 2 directly.
>>  		index = (msr - 0x200) / 2;
>> -		is_mtrr_mask = msr - 0x200 - 2 * index;
>> +		is_mtrr_mask = (msr - 0x200) % 2;
>>  		if (!is_mtrr_mask)
>>  			*pdata = vcpu->arch.mtrr_state.var_ranges[index].base;
>>  		else
>> 
>
>If you're going to do that, might as well use ">> 1" for index instead of "/ 2", and "msr & 1" for is_mtrr_mask.
>

Many thanks for suggestion. What do you mean is like this ?

	index = (msr - 0x200) >> 1;
	is_mtrr_mask = msr & 1;

Thanks again.




[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