Thread (6 messages) flat view 6 messages, 4 authors, 2007-01-26

Re: [PATCH 8/14] ps3: bind interrupt to cpu

From: Arnd Bergmann <arnd@arndb.de>
Date: 2007-01-25 06:19:56

On Thursday 25 January 2007 03:40, Geoff Levand wrote:
+struct ps3_bmp {
+=A0=A0=A0=A0=A0=A0=A0struct {
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0unsigned long status;
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0unsigned long unused_1[3];
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0unsigned long mask;
+=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0unsigned long unused_2[3];
+=A0=A0=A0=A0=A0=A0=A0} __attribute__ ((aligned (64)));
+
+=A0=A0=A0=A0=A0=A0=A0spinlock_t lock;
+=A0=A0=A0=A0=A0=A0=A0unsigned long ipi_debug_brk_mask;
+};
+
+struct ps3_private {
+=A0=A0=A0=A0=A0=A0=A0struct ps3_bmp bmp;
+=A0=A0=A0=A0=A0=A0=A0unsigned long node;
+=A0=A0=A0=A0=A0=A0=A0unsigned int cpu;
+};
This layout has some unnecessary padding in it. It turns out as:

status
unused_1
mask
unused_2
lock
/* 4 bytes pad */
ipi_debug_brk_mask
/* 48 bytes pad */
node
cpu

which you probably did not indent.

If 'status' needs to be aligned by 64 bytes, you can better express
this as

struct ps3_bmp {
       struct {
               unsigned long status;
               unsigned long unused_1[3];
               unsigned long mask;
               unsigned long unused_2[3];
       };

       unsigned long ipi_debug_brk_mask;
       spinlock_t lock;
};

struct ps3_private {
       struct ps3_bmp bmp __attribute__ ((aligned (64)));
       unsigned long node;
       unsigned int cpu;
};

which should reduce the size of your structure from 192 bytes to 64.

	Arnd <><
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help