]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
KVM: s390: randomize sca address
authorChristian Borntraeger <borntraeger@de.ibm.com>
Wed, 19 Mar 2014 10:18:29 +0000 (11:18 +0100)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Tue, 25 Mar 2014 12:27:10 +0000 (13:27 +0100)
We allocate a page for the 2k sca, so lets use the space to improve
hit rate of some internal cpu caches. No need to change the freeing
of the page, as this will shift away the page offset bits anyway.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
arch/s390/kvm/kvm-s390.c

index 7337c577e94991153eff3f2d0ff00554901e5ff7..a02979f1e1afdd115606929a681624e07f281fac 100644 (file)
@@ -215,6 +215,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 {
        int rc;
        char debug_name[16];
+       static unsigned long sca_offset;
 
        rc = -EINVAL;
 #ifdef CONFIG_KVM_S390_UCONTROL
@@ -236,6 +237,10 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
        kvm->arch.sca = (struct sca_block *) get_zeroed_page(GFP_KERNEL);
        if (!kvm->arch.sca)
                goto out_err;
+       spin_lock(&kvm_lock);
+       sca_offset = (sca_offset + 16) & 0x7f0;
+       kvm->arch.sca = (struct sca_block *) ((char *) kvm->arch.sca + sca_offset);
+       spin_unlock(&kvm_lock);
 
        sprintf(debug_name, "kvm-%u", current->pid);