From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
To: Paul Mundt <lethal@linux-sh.org>, linux-sh@vger.kernel.org
Cc: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-arch@vger.kernel.org, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH REBASED 1/3] sh: Move fpu_counter into ARCH specific thread_struct
Date: Tue, 1 Oct 2013 16:03:33 +0530 [thread overview]
Message-ID: <524AA4FD.6070001@synopsys.com> (raw)
In-Reply-To: <1379398639-27403-2-git-send-email-vgupta@synopsys.com>
Hi Paul/SH folks.
Would appreciate your ACK/NAK on this.
Thx,
-Vineet
On 09/17/2013 11:47 AM, Vineet Gupta wrote:
> Only a couple of arches (sh/x86) use fpu_counter in task_struct so it
> can be moved out into ARCH specific thread_struct, reducing the size of
> task_struct for other arches.
>
> Compile tested sh defconfig + sh4-linux-gcc (4.6.3)
>
> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
> Cc: Paul Mundt <lethal@linux-sh.org>
> Cc: Michel Lespinasse <walken@google.com>
> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Jesper Nilsson <jesper.nilsson@axis.com>
> Cc: Chris Metcalf <cmetcalf@tilera.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-arch@vger.kernel.org
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: linux-sh@vger.kernel.org
> ---
> arch/sh/include/asm/fpu.h | 2 +-
> arch/sh/include/asm/processor_32.h | 10 ++++++++++
> arch/sh/include/asm/processor_64.h | 10 ++++++++++
> arch/sh/kernel/cpu/fpu.c | 2 +-
> arch/sh/kernel/process_32.c | 6 +++---
> 5 files changed, 25 insertions(+), 5 deletions(-)
>
> diff --git a/arch/sh/include/asm/fpu.h b/arch/sh/include/asm/fpu.h
> index 06c4281..09fc2bc 100644
> --- a/arch/sh/include/asm/fpu.h
> +++ b/arch/sh/include/asm/fpu.h
> @@ -46,7 +46,7 @@ static inline void __unlazy_fpu(struct task_struct *tsk, struct pt_regs *regs)
> save_fpu(tsk);
> release_fpu(regs);
> } else
> - tsk->fpu_counter = 0;
> + tsk->thread.fpu_counter = 0;
> }
>
> static inline void unlazy_fpu(struct task_struct *tsk, struct pt_regs *regs)
> diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h
> index e699a12..18e0377 100644
> --- a/arch/sh/include/asm/processor_32.h
> +++ b/arch/sh/include/asm/processor_32.h
> @@ -111,6 +111,16 @@ struct thread_struct {
>
> /* Extended processor state */
> union thread_xstate *xstate;
> +
> + /*
> + * fpu_counter contains the number of consecutive context switches
> + * that the FPU is used. If this is over a threshold, the lazy fpu
> + * saving becomes unlazy to save the trap. This is an unsigned char
> + * so that after 256 times the counter wraps and the behavior turns
> + * lazy again; this to deal with bursty apps that only use FPU for
> + * a short time
> + */
> + unsigned char fpu_counter;
> };
>
> #define INIT_THREAD { \
> diff --git a/arch/sh/include/asm/processor_64.h b/arch/sh/include/asm/processor_64.h
> index 1cc7d31..eedd4f6 100644
> --- a/arch/sh/include/asm/processor_64.h
> +++ b/arch/sh/include/asm/processor_64.h
> @@ -126,6 +126,16 @@ struct thread_struct {
>
> /* floating point info */
> union thread_xstate *xstate;
> +
> + /*
> + * fpu_counter contains the number of consecutive context switches
> + * that the FPU is used. If this is over a threshold, the lazy fpu
> + * saving becomes unlazy to save the trap. This is an unsigned char
> + * so that after 256 times the counter wraps and the behavior turns
> + * lazy again; this to deal with bursty apps that only use FPU for
> + * a short time
> + */
> + unsigned char fpu_counter;
> };
>
> #define INIT_MMAP \
> diff --git a/arch/sh/kernel/cpu/fpu.c b/arch/sh/kernel/cpu/fpu.c
> index f8f7af5..4e33224 100644
> --- a/arch/sh/kernel/cpu/fpu.c
> +++ b/arch/sh/kernel/cpu/fpu.c
> @@ -44,7 +44,7 @@ void __fpu_state_restore(void)
> restore_fpu(tsk);
>
> task_thread_info(tsk)->status |= TS_USEDFPU;
> - tsk->fpu_counter++;
> + tsk->thread.fpu_counter++;
> }
>
> void fpu_state_restore(struct pt_regs *regs)
> diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c
> index ebd3933..2885fc9 100644
> --- a/arch/sh/kernel/process_32.c
> +++ b/arch/sh/kernel/process_32.c
> @@ -156,7 +156,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
> #endif
> ti->addr_limit = KERNEL_DS;
> ti->status &= ~TS_USEDFPU;
> - p->fpu_counter = 0;
> + p->thread.fpu_counter = 0;
> return 0;
> }
> *childregs = *current_pt_regs();
> @@ -189,7 +189,7 @@ __switch_to(struct task_struct *prev, struct task_struct *next)
> unlazy_fpu(prev, task_pt_regs(prev));
>
> /* we're going to use this soon, after a few expensive things */
> - if (next->fpu_counter > 5)
> + if (next->thread.fpu_counter > 5)
> prefetch(next_t->xstate);
>
> #ifdef CONFIG_MMU
> @@ -207,7 +207,7 @@ __switch_to(struct task_struct *prev, struct task_struct *next)
> * restore of the math state immediately to avoid the trap; the
> * chances of needing FPU soon are obviously high now
> */
> - if (next->fpu_counter > 5)
> + if (next->thread.fpu_counter > 5)
> __fpu_state_restore();
>
> return prev;
>
WARNING: multiple messages have this Message-ID (diff)
From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
To: Paul Mundt <lethal@linux-sh.org>, linux-sh@vger.kernel.org
Cc: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-arch@vger.kernel.org, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH REBASED 1/3] sh: Move fpu_counter into ARCH specific thread_struct
Date: Tue, 01 Oct 2013 10:45:33 +0000 [thread overview]
Message-ID: <524AA4FD.6070001@synopsys.com> (raw)
In-Reply-To: <1379398639-27403-2-git-send-email-vgupta@synopsys.com>
Hi Paul/SH folks.
Would appreciate your ACK/NAK on this.
Thx,
-Vineet
On 09/17/2013 11:47 AM, Vineet Gupta wrote:
> Only a couple of arches (sh/x86) use fpu_counter in task_struct so it
> can be moved out into ARCH specific thread_struct, reducing the size of
> task_struct for other arches.
>
> Compile tested sh defconfig + sh4-linux-gcc (4.6.3)
>
> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
> Cc: Paul Mundt <lethal@linux-sh.org>
> Cc: Michel Lespinasse <walken@google.com>
> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Jesper Nilsson <jesper.nilsson@axis.com>
> Cc: Chris Metcalf <cmetcalf@tilera.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-arch@vger.kernel.org
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: linux-sh@vger.kernel.org
> ---
> arch/sh/include/asm/fpu.h | 2 +-
> arch/sh/include/asm/processor_32.h | 10 ++++++++++
> arch/sh/include/asm/processor_64.h | 10 ++++++++++
> arch/sh/kernel/cpu/fpu.c | 2 +-
> arch/sh/kernel/process_32.c | 6 +++---
> 5 files changed, 25 insertions(+), 5 deletions(-)
>
> diff --git a/arch/sh/include/asm/fpu.h b/arch/sh/include/asm/fpu.h
> index 06c4281..09fc2bc 100644
> --- a/arch/sh/include/asm/fpu.h
> +++ b/arch/sh/include/asm/fpu.h
> @@ -46,7 +46,7 @@ static inline void __unlazy_fpu(struct task_struct *tsk, struct pt_regs *regs)
> save_fpu(tsk);
> release_fpu(regs);
> } else
> - tsk->fpu_counter = 0;
> + tsk->thread.fpu_counter = 0;
> }
>
> static inline void unlazy_fpu(struct task_struct *tsk, struct pt_regs *regs)
> diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h
> index e699a12..18e0377 100644
> --- a/arch/sh/include/asm/processor_32.h
> +++ b/arch/sh/include/asm/processor_32.h
> @@ -111,6 +111,16 @@ struct thread_struct {
>
> /* Extended processor state */
> union thread_xstate *xstate;
> +
> + /*
> + * fpu_counter contains the number of consecutive context switches
> + * that the FPU is used. If this is over a threshold, the lazy fpu
> + * saving becomes unlazy to save the trap. This is an unsigned char
> + * so that after 256 times the counter wraps and the behavior turns
> + * lazy again; this to deal with bursty apps that only use FPU for
> + * a short time
> + */
> + unsigned char fpu_counter;
> };
>
> #define INIT_THREAD { \
> diff --git a/arch/sh/include/asm/processor_64.h b/arch/sh/include/asm/processor_64.h
> index 1cc7d31..eedd4f6 100644
> --- a/arch/sh/include/asm/processor_64.h
> +++ b/arch/sh/include/asm/processor_64.h
> @@ -126,6 +126,16 @@ struct thread_struct {
>
> /* floating point info */
> union thread_xstate *xstate;
> +
> + /*
> + * fpu_counter contains the number of consecutive context switches
> + * that the FPU is used. If this is over a threshold, the lazy fpu
> + * saving becomes unlazy to save the trap. This is an unsigned char
> + * so that after 256 times the counter wraps and the behavior turns
> + * lazy again; this to deal with bursty apps that only use FPU for
> + * a short time
> + */
> + unsigned char fpu_counter;
> };
>
> #define INIT_MMAP \
> diff --git a/arch/sh/kernel/cpu/fpu.c b/arch/sh/kernel/cpu/fpu.c
> index f8f7af5..4e33224 100644
> --- a/arch/sh/kernel/cpu/fpu.c
> +++ b/arch/sh/kernel/cpu/fpu.c
> @@ -44,7 +44,7 @@ void __fpu_state_restore(void)
> restore_fpu(tsk);
>
> task_thread_info(tsk)->status |= TS_USEDFPU;
> - tsk->fpu_counter++;
> + tsk->thread.fpu_counter++;
> }
>
> void fpu_state_restore(struct pt_regs *regs)
> diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c
> index ebd3933..2885fc9 100644
> --- a/arch/sh/kernel/process_32.c
> +++ b/arch/sh/kernel/process_32.c
> @@ -156,7 +156,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
> #endif
> ti->addr_limit = KERNEL_DS;
> ti->status &= ~TS_USEDFPU;
> - p->fpu_counter = 0;
> + p->thread.fpu_counter = 0;
> return 0;
> }
> *childregs = *current_pt_regs();
> @@ -189,7 +189,7 @@ __switch_to(struct task_struct *prev, struct task_struct *next)
> unlazy_fpu(prev, task_pt_regs(prev));
>
> /* we're going to use this soon, after a few expensive things */
> - if (next->fpu_counter > 5)
> + if (next->thread.fpu_counter > 5)
> prefetch(next_t->xstate);
>
> #ifdef CONFIG_MMU
> @@ -207,7 +207,7 @@ __switch_to(struct task_struct *prev, struct task_struct *next)
> * restore of the math state immediately to avoid the trap; the
> * chances of needing FPU soon are obviously high now
> */
> - if (next->fpu_counter > 5)
> + if (next->thread.fpu_counter > 5)
> __fpu_state_restore();
>
> return prev;
>
WARNING: multiple messages have this Message-ID (diff)
From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
To: Paul Mundt <lethal@linux-sh.org>, <linux-sh@vger.kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
<linux-arch@vger.kernel.org>, lkml <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH REBASED 1/3] sh: Move fpu_counter into ARCH specific thread_struct
Date: Tue, 1 Oct 2013 16:03:33 +0530 [thread overview]
Message-ID: <524AA4FD.6070001@synopsys.com> (raw)
In-Reply-To: <1379398639-27403-2-git-send-email-vgupta@synopsys.com>
Hi Paul/SH folks.
Would appreciate your ACK/NAK on this.
Thx,
-Vineet
On 09/17/2013 11:47 AM, Vineet Gupta wrote:
> Only a couple of arches (sh/x86) use fpu_counter in task_struct so it
> can be moved out into ARCH specific thread_struct, reducing the size of
> task_struct for other arches.
>
> Compile tested sh defconfig + sh4-linux-gcc (4.6.3)
>
> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
> Cc: Paul Mundt <lethal@linux-sh.org>
> Cc: Michel Lespinasse <walken@google.com>
> Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Jesper Nilsson <jesper.nilsson@axis.com>
> Cc: Chris Metcalf <cmetcalf@tilera.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-arch@vger.kernel.org
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: linux-sh@vger.kernel.org
> ---
> arch/sh/include/asm/fpu.h | 2 +-
> arch/sh/include/asm/processor_32.h | 10 ++++++++++
> arch/sh/include/asm/processor_64.h | 10 ++++++++++
> arch/sh/kernel/cpu/fpu.c | 2 +-
> arch/sh/kernel/process_32.c | 6 +++---
> 5 files changed, 25 insertions(+), 5 deletions(-)
>
> diff --git a/arch/sh/include/asm/fpu.h b/arch/sh/include/asm/fpu.h
> index 06c4281..09fc2bc 100644
> --- a/arch/sh/include/asm/fpu.h
> +++ b/arch/sh/include/asm/fpu.h
> @@ -46,7 +46,7 @@ static inline void __unlazy_fpu(struct task_struct *tsk, struct pt_regs *regs)
> save_fpu(tsk);
> release_fpu(regs);
> } else
> - tsk->fpu_counter = 0;
> + tsk->thread.fpu_counter = 0;
> }
>
> static inline void unlazy_fpu(struct task_struct *tsk, struct pt_regs *regs)
> diff --git a/arch/sh/include/asm/processor_32.h b/arch/sh/include/asm/processor_32.h
> index e699a12..18e0377 100644
> --- a/arch/sh/include/asm/processor_32.h
> +++ b/arch/sh/include/asm/processor_32.h
> @@ -111,6 +111,16 @@ struct thread_struct {
>
> /* Extended processor state */
> union thread_xstate *xstate;
> +
> + /*
> + * fpu_counter contains the number of consecutive context switches
> + * that the FPU is used. If this is over a threshold, the lazy fpu
> + * saving becomes unlazy to save the trap. This is an unsigned char
> + * so that after 256 times the counter wraps and the behavior turns
> + * lazy again; this to deal with bursty apps that only use FPU for
> + * a short time
> + */
> + unsigned char fpu_counter;
> };
>
> #define INIT_THREAD { \
> diff --git a/arch/sh/include/asm/processor_64.h b/arch/sh/include/asm/processor_64.h
> index 1cc7d31..eedd4f6 100644
> --- a/arch/sh/include/asm/processor_64.h
> +++ b/arch/sh/include/asm/processor_64.h
> @@ -126,6 +126,16 @@ struct thread_struct {
>
> /* floating point info */
> union thread_xstate *xstate;
> +
> + /*
> + * fpu_counter contains the number of consecutive context switches
> + * that the FPU is used. If this is over a threshold, the lazy fpu
> + * saving becomes unlazy to save the trap. This is an unsigned char
> + * so that after 256 times the counter wraps and the behavior turns
> + * lazy again; this to deal with bursty apps that only use FPU for
> + * a short time
> + */
> + unsigned char fpu_counter;
> };
>
> #define INIT_MMAP \
> diff --git a/arch/sh/kernel/cpu/fpu.c b/arch/sh/kernel/cpu/fpu.c
> index f8f7af5..4e33224 100644
> --- a/arch/sh/kernel/cpu/fpu.c
> +++ b/arch/sh/kernel/cpu/fpu.c
> @@ -44,7 +44,7 @@ void __fpu_state_restore(void)
> restore_fpu(tsk);
>
> task_thread_info(tsk)->status |= TS_USEDFPU;
> - tsk->fpu_counter++;
> + tsk->thread.fpu_counter++;
> }
>
> void fpu_state_restore(struct pt_regs *regs)
> diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c
> index ebd3933..2885fc9 100644
> --- a/arch/sh/kernel/process_32.c
> +++ b/arch/sh/kernel/process_32.c
> @@ -156,7 +156,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
> #endif
> ti->addr_limit = KERNEL_DS;
> ti->status &= ~TS_USEDFPU;
> - p->fpu_counter = 0;
> + p->thread.fpu_counter = 0;
> return 0;
> }
> *childregs = *current_pt_regs();
> @@ -189,7 +189,7 @@ __switch_to(struct task_struct *prev, struct task_struct *next)
> unlazy_fpu(prev, task_pt_regs(prev));
>
> /* we're going to use this soon, after a few expensive things */
> - if (next->fpu_counter > 5)
> + if (next->thread.fpu_counter > 5)
> prefetch(next_t->xstate);
>
> #ifdef CONFIG_MMU
> @@ -207,7 +207,7 @@ __switch_to(struct task_struct *prev, struct task_struct *next)
> * restore of the math state immediately to avoid the trap; the
> * chances of needing FPU soon are obviously high now
> */
> - if (next->fpu_counter > 5)
> + if (next->thread.fpu_counter > 5)
> __fpu_state_restore();
>
> return prev;
>
next prev parent reply other threads:[~2013-10-01 10:33 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-17 6:17 [RFC PATCH REBASED 0/3] Move ARCH specific fpu_counter out of task_struct Vineet Gupta
2013-09-17 6:17 ` Vineet Gupta
2013-09-17 6:17 ` [RFC PATCH REBASED 1/3] sh: Move fpu_counter into ARCH specific thread_struct Vineet Gupta
2013-09-17 6:29 ` Vineet Gupta
2013-09-17 6:17 ` Vineet Gupta
2013-09-17 8:00 ` Peter Zijlstra
2013-09-17 8:14 ` Vineet Gupta
2013-09-17 8:25 ` Peter Zijlstra
2013-09-17 8:25 ` Peter Zijlstra
2013-10-01 10:33 ` Vineet Gupta [this message]
2013-10-01 10:45 ` Vineet Gupta
2013-10-01 10:33 ` Vineet Gupta
2013-09-17 6:17 ` [RFC PATCH REBASED 2/3] x86: " Vineet Gupta
2013-09-17 6:17 ` Vineet Gupta
2013-09-17 10:34 ` Vineet Gupta
2013-09-23 6:58 ` Vineet Gupta
2013-09-18 18:12 ` Paul Gortmaker
2013-09-18 18:15 ` Paul Gortmaker
2013-09-23 8:33 ` Ingo Molnar
2013-10-04 11:24 ` Vineet Gupta
2013-09-17 6:17 ` [RFC PATCH REBASED 3/3] sched: Remove ARCH specific fpu_counter from task_struct Vineet Gupta
2013-09-17 6:17 ` Vineet Gupta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=524AA4FD.6070001@synopsys.com \
--to=vineet.gupta1@synopsys.com \
--cc=akpm@linux-foundation.org \
--cc=lethal@linux-sh.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.