• Heiko Carstens's avatar
    s390/fpu: limit save and restore to used registers · 8c09871a
    Heiko Carstens authored
    The first invocation of kernel_fpu_begin() after switching from user to
    kernel context will save all vector registers, even if only parts of the
    vector registers are used within the kernel fpu context. Given that save
    and restore of all vector registers is quite expensive change the current
    approach in several ways:
    
    - Instead of saving and restoring all user registers limit this to those
      registers which are actually used within an kernel fpu context.
    
    - On context switch save all remaining user fpu registers, so they can be
      restored when the task is rescheduled.
    
    - Saving user registers within kernel_fpu_begin() is done without disabling
      and enabling interrupts - which also slightly reduces runtime. In worst
      case (e.g. interrupt context uses the same registers) this may lead to
      the situation that registers are saved several times, however the
      assumption is that this will not happen frequently, so that the new
      method is faster in nearly all cases.
    
    - save_user_fpu_regs() can still be called from all contexts and saves all
      (or all remaining) user registers to a tasks ufpu user fpu save area.
    
    Overall this reduces the time required to save and restore the user fpu
    context for nearly all cases.
    Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
    8c09871a
entry-common.h 1.44 KB