Skip to content

Commit 8d61eef

Browse files
mrutland-armwilldeacon
authored andcommitted
arm64/fpsimd: Remove redundant task->mm check
For historical reasons, arch_dup_task_struct() only calls fpsimd_preserve_current_state() when current->mm is non-NULL, but this is no longer necessary. Historically TIF_FOREIGN_FPSTATE was only managed for user threads, and was never set for kernel threads. At the time, various functions attempted to avoid saving/restoring state for kernel threads by checking task_struct::mm to try to distinguish user threads from kernel threads. We added the current->mm check to arch_dup_task_struct() in commit: 6eb6c80 ("arm64: kernel thread don't need to save fpsimd context.") ... where the intent was to avoid pointlessly saving state for kernel threads, which never had live state (and the saved state would never be consumed). Subsequently we began setting TIF_FOREIGN_FPSTATE for kernel threads, and removed most of the task_struct::mm checks in commit: df3fb96 ("arm64: fpsimd: Eliminate task->mm checks") ... but we missed the check in arch_dup_task_struct(), which is similarly redundant. Remove the redundant check from arch_dup_task_struct(). Signed-off-by: Mark Rutland <[email protected]> Cc: Catalin Marinas <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Mark Brown <[email protected]> Cc: Will Deacon <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 99560c9 commit 8d61eef

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

arch/arm64/kernel/process.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,7 @@ void arch_release_task_struct(struct task_struct *tsk)
344344

345345
int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
346346
{
347-
if (current->mm)
348-
fpsimd_preserve_current_state();
347+
fpsimd_preserve_current_state();
349348
*dst = *src;
350349

351350
/*

0 commit comments

Comments
 (0)