[PATCH v2 6/7] x86, fpu: shift "fpu_counter = 0" from copy_thread() to arch_dup_task_struct()

2014-09-02 Thread Oleg Nesterov
Cosmetic, but I think thread.fpu_counter should be initialized in
arch_dup_task_struct() too, along with other "fpu" variables. And
probably it make sense to turn it into thread.fpu->counter.

Signed-off-by: Oleg Nesterov 
Reviewed-by: Suresh Siddha 
---
 arch/x86/kernel/process.c|1 +
 arch/x86/kernel/process_32.c |2 --
 arch/x86/kernel/process_64.c |1 -
 3 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 9b9f088..5df9447 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -66,6 +66,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct 
task_struct *src)
 {
*dst = *src;
 
+   dst->thread.fpu_counter = 0;
dst->thread.fpu.has_fpu = 0;
dst->thread.fpu.last_cpu = ~0;
dst->thread.fpu.state = NULL;
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 7bc86bb..c73b3c1 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -152,7 +152,6 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
childregs->orig_ax = -1;
childregs->cs = __KERNEL_CS | get_kernel_rpl();
childregs->flags = X86_EFLAGS_IF | X86_EFLAGS_FIXED;
-   p->thread.fpu_counter = 0;
p->thread.io_bitmap_ptr = NULL;
memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps));
return 0;
@@ -165,7 +164,6 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
p->thread.ip = (unsigned long) ret_from_fork;
task_user_gs(p) = get_user_gs(current_pt_regs());
 
-   p->thread.fpu_counter = 0;
p->thread.io_bitmap_ptr = NULL;
tsk = current;
err = -ENOMEM;
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index ca5b02d..593257d 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -163,7 +163,6 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
p->thread.sp = (unsigned long) childregs;
p->thread.usersp = me->thread.usersp;
set_tsk_thread_flag(p, TIF_FORK);
-   p->thread.fpu_counter = 0;
p->thread.io_bitmap_ptr = NULL;
 
savesegment(gs, p->thread.gsindex);
-- 
1.5.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 6/7] x86, fpu: shift fpu_counter = 0 from copy_thread() to arch_dup_task_struct()

2014-09-02 Thread Oleg Nesterov
Cosmetic, but I think thread.fpu_counter should be initialized in
arch_dup_task_struct() too, along with other fpu variables. And
probably it make sense to turn it into thread.fpu-counter.

Signed-off-by: Oleg Nesterov o...@redhat.com
Reviewed-by: Suresh Siddha sbsid...@gmail.com
---
 arch/x86/kernel/process.c|1 +
 arch/x86/kernel/process_32.c |2 --
 arch/x86/kernel/process_64.c |1 -
 3 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 9b9f088..5df9447 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -66,6 +66,7 @@ int arch_dup_task_struct(struct task_struct *dst, struct 
task_struct *src)
 {
*dst = *src;
 
+   dst-thread.fpu_counter = 0;
dst-thread.fpu.has_fpu = 0;
dst-thread.fpu.last_cpu = ~0;
dst-thread.fpu.state = NULL;
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 7bc86bb..c73b3c1 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -152,7 +152,6 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
childregs-orig_ax = -1;
childregs-cs = __KERNEL_CS | get_kernel_rpl();
childregs-flags = X86_EFLAGS_IF | X86_EFLAGS_FIXED;
-   p-thread.fpu_counter = 0;
p-thread.io_bitmap_ptr = NULL;
memset(p-thread.ptrace_bps, 0, sizeof(p-thread.ptrace_bps));
return 0;
@@ -165,7 +164,6 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
p-thread.ip = (unsigned long) ret_from_fork;
task_user_gs(p) = get_user_gs(current_pt_regs());
 
-   p-thread.fpu_counter = 0;
p-thread.io_bitmap_ptr = NULL;
tsk = current;
err = -ENOMEM;
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index ca5b02d..593257d 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -163,7 +163,6 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
p-thread.sp = (unsigned long) childregs;
p-thread.usersp = me-thread.usersp;
set_tsk_thread_flag(p, TIF_FORK);
-   p-thread.fpu_counter = 0;
p-thread.io_bitmap_ptr = NULL;
 
savesegment(gs, p-thread.gsindex);
-- 
1.5.5.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/