Skip to contentSkip to conversation

x86: fpu_clone function is changed to return type void

PATCH New Li kunyu 1 participant 1 message Jun 9, 2022 x86

lore
Share & tools
lore

Li kunyu

author
#0 lore raw

PATCH 1/1 x86: fpu_clone function is changed to return type void

It is used to reduce the number of eax calls, improve the execution efficiency, and use the same return type as fpu__drop and other functions.

---
 arch/x86/include/asm/fpu/sched.h | 2 +-
 arch/x86/kernel/fpu/core.c       | 8 +++-----
 2 files changed, 4 insertions(+), 6 deletions(-)
arch/x86/include/asm/fpu/sched.h +1 -1
index b2486b2cbc6e..ca29fd8550ed 100644
@@ -11,7 +11,7 @@
 
 extern void save_fpregs_to_fpstate(struct fpu *fpu);
 extern void fpu__drop(struct fpu *fpu);
-extern int  fpu_clone(struct task_struct *dst, unsigned long clone_flags, bool minimal);
+extern void  fpu_clone(struct task_struct *dst, unsigned long clone_flags, bool minimal);
 extern void fpu_flush_thread(void);
 
 /*
arch/x86/kernel/fpu/core.c +3 -5
index 0531d6a06df5..416dcdba992a 100644
@@ -556,7 +556,7 @@ static inline void fpu_inherit_perms(struct fpu *dst_fpu)
 }
 
 /* Clone current's FPU state on fork */
-int fpu_clone(struct task_struct *dst, unsigned long clone_flags, bool minimal)
+void fpu_clone(struct task_struct *dst, unsigned long clone_flags, bool minimal)
 {
 	struct fpu *src_fpu = &current->thread.fpu;
 	struct fpu *dst_fpu = &dst->thread.fpu;
@@ -567,7 +567,7 @@ int fpu_clone(struct task_struct *dst, unsigned long clone_flags, bool minimal)
 	fpstate_reset(dst_fpu);
 
 	if (!cpu_feature_enabled(X86_FEATURE_FPU))
-		return 0;
+		return;
 
 	/*
 	 * Enforce reload for user space tasks and prevent kernel threads
@@ -583,7 +583,7 @@ int fpu_clone(struct task_struct *dst, unsigned long clone_flags, bool minimal)
 		/* Clear out the minimal state */
 		memcpy(&dst_fpu->fpstate->regs, &init_fpstate.regs,
 		       init_fpstate_copy_size());
-		return 0;
+		return;
 	}
 
 	/*
@@ -618,8 +618,6 @@ int fpu_clone(struct task_struct *dst, unsigned long clone_flags, bool minimal)
 
 	trace_x86_fpu_copy_src(src_fpu);
 	trace_x86_fpu_copy_dst(dst_fpu);
-
-	return 0;
 }
 
 /*
Signature · 1 line
2.18.2