All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc: book3e_64: fix the align size for paca_struct
@ 2015-03-07 11:14 Kevin Hao
  2015-03-08  9:13 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Hao @ 2015-03-07 11:14 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Scott Wood, Paul Mackerras

All the cache line size of the current book3e 64bit SoCs are 64 bytes.
So we should use this size to align the member of paca_struct.
With this change we save 192 bytes. Also change it to __aligned(size)
since it is preferred over __attribute__((aligned(size))).

Before:
	/* size: 1920, cachelines: 30, members: 46 */
	/* sum members: 1667, holes: 6, sum holes: 141 */
	/* padding: 112 */

After:
	/* size: 1728, cachelines: 27, members: 46 */
	/* sum members: 1667, holes: 4, sum holes: 13 */
	/* padding: 48 */

Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
 arch/powerpc/include/asm/paca.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index e5f22c6c4bf9..70bd4381f8e6 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -106,9 +106,9 @@ struct paca_struct {
 #endif /* CONFIG_PPC_STD_MMU_64 */
 
 #ifdef CONFIG_PPC_BOOK3E
-	u64 exgen[8] __attribute__((aligned(0x80)));
+	u64 exgen[8] __aligned(0x40);
 	/* Keep pgd in the same cacheline as the start of extlb */
-	pgd_t *pgd __attribute__((aligned(0x80))); /* Current PGD */
+	pgd_t *pgd __aligned(0x40); /* Current PGD */
 	pgd_t *kernel_pgd;		/* Kernel PGD */
 
 	/* Shared by all threads of a core -- points to tcd of first thread */
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] powerpc: book3e_64: fix the align size for paca_struct
  2015-03-07 11:14 [PATCH] powerpc: book3e_64: fix the align size for paca_struct Kevin Hao
@ 2015-03-08  9:13 ` Benjamin Herrenschmidt
  2015-03-09  1:13   ` Kevin Hao
  0 siblings, 1 reply; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2015-03-08  9:13 UTC (permalink / raw)
  To: Kevin Hao; +Cc: Scott Wood, Paul Mackerras, linuxppc-dev

On Sat, 2015-03-07 at 19:14 +0800, Kevin Hao wrote:
> All the cache line size of the current book3e 64bit SoCs are 64 bytes.
> So we should use this size to align the member of paca_struct.
> With this change we save 192 bytes. Also change it to __aligned(size)
> since it is preferred over __attribute__((aligned(size))).

Why should we favor the book3e CPUs over the book3s ones ? Since we
can't build a kernel that deals with both, make it a compile option.

> Before:
> 	/* size: 1920, cachelines: 30, members: 46 */
> 	/* sum members: 1667, holes: 6, sum holes: 141 */
> 	/* padding: 112 */
> 
> After:
> 	/* size: 1728, cachelines: 27, members: 46 */
> 	/* sum members: 1667, holes: 4, sum holes: 13 */
> 	/* padding: 48 */
> 
> Signed-off-by: Kevin Hao <haokexin@gmail.com>
> ---
>  arch/powerpc/include/asm/paca.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
> index e5f22c6c4bf9..70bd4381f8e6 100644
> --- a/arch/powerpc/include/asm/paca.h
> +++ b/arch/powerpc/include/asm/paca.h
> @@ -106,9 +106,9 @@ struct paca_struct {
>  #endif /* CONFIG_PPC_STD_MMU_64 */
>  
>  #ifdef CONFIG_PPC_BOOK3E
> -	u64 exgen[8] __attribute__((aligned(0x80)));
> +	u64 exgen[8] __aligned(0x40);
>  	/* Keep pgd in the same cacheline as the start of extlb */
> -	pgd_t *pgd __attribute__((aligned(0x80))); /* Current PGD */
> +	pgd_t *pgd __aligned(0x40); /* Current PGD */
>  	pgd_t *kernel_pgd;		/* Kernel PGD */
>  
>  	/* Shared by all threads of a core -- points to tcd of first thread */

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] powerpc: book3e_64: fix the align size for paca_struct
  2015-03-08  9:13 ` Benjamin Herrenschmidt
@ 2015-03-09  1:13   ` Kevin Hao
  2015-03-09  7:31     ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Hao @ 2015-03-09  1:13 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Scott Wood, Paul Mackerras, linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 685 bytes --]

On Sun, Mar 08, 2015 at 08:13:26PM +1100, Benjamin Herrenschmidt wrote:
> On Sat, 2015-03-07 at 19:14 +0800, Kevin Hao wrote:
> > All the cache line size of the current book3e 64bit SoCs are 64 bytes.
> > So we should use this size to align the member of paca_struct.
> > With this change we save 192 bytes. Also change it to __aligned(size)
> > since it is preferred over __attribute__((aligned(size))).
> 
> Why should we favor the book3e CPUs over the book3s ones ?

Why do you think so? This only change the align size of the paca_struct's
members which are private to book3e CPUs, and should not have any effect
to book3s ones. Did I miss something?

Thanks,
Kevin

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] powerpc: book3e_64: fix the align size for paca_struct
  2015-03-09  1:13   ` Kevin Hao
@ 2015-03-09  7:31     ` Benjamin Herrenschmidt
  2015-03-10 12:21       ` Kevin Hao
  0 siblings, 1 reply; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2015-03-09  7:31 UTC (permalink / raw)
  To: Kevin Hao; +Cc: Scott Wood, Paul Mackerras, linuxppc-dev

On Mon, 2015-03-09 at 09:13 +0800, Kevin Hao wrote:
> On Sun, Mar 08, 2015 at 08:13:26PM +1100, Benjamin Herrenschmidt wrote:
> > On Sat, 2015-03-07 at 19:14 +0800, Kevin Hao wrote:
> > > All the cache line size of the current book3e 64bit SoCs are 64 bytes.
> > > So we should use this size to align the member of paca_struct.
> > > With this change we save 192 bytes. Also change it to __aligned(size)
> > > since it is preferred over __attribute__((aligned(size))).
> > 
> > Why should we favor the book3e CPUs over the book3s ones ?
> 
> Why do you think so? This only change the align size of the paca_struct's
> members which are private to book3e CPUs, and should not have any effect
> to book3s ones. Did I miss something?

No, your explanation was lacking that important detail :-)

> Thanks,
> Kevin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] powerpc: book3e_64: fix the align size for paca_struct
  2015-03-09  7:31     ` Benjamin Herrenschmidt
@ 2015-03-10 12:21       ` Kevin Hao
  0 siblings, 0 replies; 5+ messages in thread
From: Kevin Hao @ 2015-03-10 12:21 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Scott Wood, Paul Mackerras, linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 1002 bytes --]

On Mon, Mar 09, 2015 at 06:31:25PM +1100, Benjamin Herrenschmidt wrote:
> On Mon, 2015-03-09 at 09:13 +0800, Kevin Hao wrote:
> > On Sun, Mar 08, 2015 at 08:13:26PM +1100, Benjamin Herrenschmidt wrote:
> > > On Sat, 2015-03-07 at 19:14 +0800, Kevin Hao wrote:
> > > > All the cache line size of the current book3e 64bit SoCs are 64 bytes.
> > > > So we should use this size to align the member of paca_struct.
> > > > With this change we save 192 bytes. Also change it to __aligned(size)
> > > > since it is preferred over __attribute__((aligned(size))).
> > > 
> > > Why should we favor the book3e CPUs over the book3s ones ?
> > 
> > Why do you think so? This only change the align size of the paca_struct's
> > members which are private to book3e CPUs, and should not have any effect
> > to book3s ones. Did I miss something?
> 
> No, your explanation was lacking that important detail :-)

Sorry for the confusion, I will add this information in the commit log.

Thanks,
Kevin

[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-03-10 12:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-07 11:14 [PATCH] powerpc: book3e_64: fix the align size for paca_struct Kevin Hao
2015-03-08  9:13 ` Benjamin Herrenschmidt
2015-03-09  1:13   ` Kevin Hao
2015-03-09  7:31     ` Benjamin Herrenschmidt
2015-03-10 12:21       ` Kevin Hao

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.