From: Stefan Richter Date: Sat, 29 Nov 2008 18:00:56 +0000 (+0100) Subject: firewire: reorder struct fw_card for better cache efficiency X-Git-Tag: v2.6.29-rc1~187^2 X-Git-Url: http://ftp.safe.ca/?a=commitdiff_plain;ds=sidebyside;h=c8a12d45d543905a2718fccafd612edbd73a1341;p=safe%2Fjmp%2Flinux-2.6 firewire: reorder struct fw_card for better cache efficiency topology_map is by far the largest member in struct fw_card. Move it to the very end of the struct so that card pointer dereferences have better chances to hit the CPU cache. This requires to increase the topology_map backing store to the size specified in IEEE 1394, i.e. 256 rather than 255 quadlets. Otherwise the topology_map response handler may access invalid memory. Signed-off-by: Stefan Richter --- diff --git a/drivers/firewire/fw-transaction.h b/drivers/firewire/fw-transaction.h index 5a57bb8..c9ab12a 100644 --- a/drivers/firewire/fw-transaction.h +++ b/drivers/firewire/fw-transaction.h @@ -237,13 +237,6 @@ struct fw_card { int link_speed; int config_rom_generation; - /* - * We need to store up to 4 self ID for a maximum of 63 - * devices plus 3 words for the topology map header. - */ - u32 topology_map[252 + 3]; - u32 broadcast_channel; - spinlock_t lock; /* Take this lock when handling the lists in * this struct. */ struct fw_node *local_node; @@ -261,6 +254,9 @@ struct fw_card { struct delayed_work work; int bm_retries; int bm_generation; + + u32 broadcast_channel; + u32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4]; }; static inline struct fw_card *fw_card_get(struct fw_card *card)