Skip to content

Commit

Permalink
[S390] switch_to: dont restore/save access & fpu regs for kernel threads
Browse files Browse the repository at this point in the history
If the previous task was a kernel thread there is no need to save the
contents of the fpu and access registers since they aren't used in
kernel mode.
For the same reason it is not necessary to restore these registers if
the next task is a kernel thread.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
heicarst authored and Martin Schwidefsky committed Oct 25, 2010
1 parent f861e40 commit fdb6d07
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions arch/s390/include/asm/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,18 @@ static inline void restore_access_regs(unsigned int *acrs)
asm volatile("lam 0,15,%0" : : "Q" (*acrs));
}

#define switch_to(prev,next,last) do { \
if (prev == next) \
break; \
save_fp_regs(&prev->thread.fp_regs); \
restore_fp_regs(&next->thread.fp_regs); \
save_access_regs(&prev->thread.acrs[0]); \
restore_access_regs(&next->thread.acrs[0]); \
prev = __switch_to(prev,next); \
#define switch_to(prev,next,last) do { \
if (prev == next) \
break; \
if (prev->mm) { \
save_fp_regs(&prev->thread.fp_regs); \
save_access_regs(&prev->thread.acrs[0]); \
} \
if (next->mm) { \
restore_fp_regs(&next->thread.fp_regs); \
restore_access_regs(&next->thread.acrs[0]); \
} \
prev = __switch_to(prev,next); \
} while (0)

extern void account_vtime(struct task_struct *, struct task_struct *);
Expand Down

0 comments on commit fdb6d07

Please sign in to comment.