[PATCH] x86: fpu_clone function is changed to return type void

From: Li kunyu
Date: Thu Jun 09 2022 - 01:24:00 EST


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.

Signed-off-by: Li kunyu <kunyu@xxxxxxxxxxxx>
---
arch/x86/include/asm/fpu/sched.h | 2 +-
arch/x86/kernel/fpu/core.c | 8 +++-----
2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/x86/include/asm/fpu/sched.h b/arch/x86/include/asm/fpu/sched.h
index b2486b2cbc6e..ca29fd8550ed 100644
--- a/arch/x86/include/asm/fpu/sched.h
+++ b/arch/x86/include/asm/fpu/sched.h
@@ -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);

/*
diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
index 0531d6a06df5..416dcdba992a 100644
--- a/arch/x86/kernel/fpu/core.c
+++ b/arch/x86/kernel/fpu/core.c
@@ -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;
}

/*
--
2.18.2