Re: [PATCH 12/22] x86/fpu: Only write PKRU if it is different from current

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

 



On 2/21/19 3:50 AM, Sebastian Andrzej Siewior wrote:
> @@ -111,6 +111,12 @@ static inline void __write_pkru(u32 pkru)
>  {
>  	u32 ecx = 0, edx = 0;
>  
> +	/*
> +	 * WRPKRU is relatively expensive compared to RDPKRU.
> +	 * Avoid WRPKRU when it would not change the value.
> +	 */
> +	if (pkru == __read_pkru())
> +		return;
>  	/*
>  	 * "wrpkru" instruction.  Loads contents in EAX to PKRU,
>  	 * requires that ecx = edx = 0.

Could we do this in write_pkru() instead?  I tried to keep the __
versions of read and write as simple and symmetric as possible.



[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