arm64: kernel thread don't need to save fpsimd context.
authorJanet Liu <janet.liu@spreadtrum.com>
Thu, 11 Jun 2015 04:04:32 +0000 (12:04 +0800)
committerCatalin Marinas <catalin.marinas@arm.com>
Thu, 11 Jun 2015 14:35:23 +0000 (15:35 +0100)
kernel thread's default fpsimd state is zero. When fork a thread, if parent is kernel thread,
 and save hardware context to parent's fpsimd state, but this hardware context is user
process's context, because kernel thread don't use fpsimd, it will not introduce issue,
it add a little cost.

Signed-off-by: Janet Liu <janet.liu@spreadtrum.com>
Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/kernel/process.c

index 369f485f4b7118a89c4af135ed1d28a3c90d0bd7..223b093c9440933f46fb2aa4cbc83729be1e6f57 100644 (file)
@@ -233,7 +233,8 @@ void release_thread(struct task_struct *dead_task)
 
 int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
 {
-       fpsimd_preserve_current_state();
+       if (current->mm)
+               fpsimd_preserve_current_state();
        *dst = *src;
        return 0;
 }