* [PATCH] firewire: core: reduce stack usage in bus reset tasklet
@ 2009-08-28 13:20 Stefan Richter
0 siblings, 0 replies; only message in thread
From: Stefan Richter @ 2009-08-28 13:20 UTC (permalink / raw)
To: linux1394-devel; +Cc: linux-kernel
fw_compute_block_crc() used 1024 bytes of the kernel stack. This
function is called
- in process context when the local node's config ROM is updated,
- in tasklet context of the bus reset handler.
Replace the stack-allocated buffer by a static buffer.
Serialize buffer accesses by a static local spinlock.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
drivers/firewire/core-card.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
Index: linux-2.6.31-rc8/drivers/firewire/core-card.c
===================================================================
--- linux-2.6.31-rc8.orig/drivers/firewire/core-card.c
+++ linux-2.6.31-rc8/drivers/firewire/core-card.c
@@ -40,13 +40,19 @@
int fw_compute_block_crc(u32 *block)
{
- __be32 be32_block[256];
+ static DEFINE_SPINLOCK(buffer_lock);
+ static __be32 buffer[256];
+ unsigned long flags;
int i, length;
+ spin_lock_irqsave(&buffer_lock, flags);
+
length = (*block >> 16) & 0xff;
for (i = 0; i < length; i++)
- be32_block[i] = cpu_to_be32(block[i + 1]);
- *block |= crc_itu_t(0, (u8 *) be32_block, length * 4);
+ buffer[i] = cpu_to_be32(block[i + 1]);
+ *block |= crc_itu_t(0, (u8 *)buffer, length * 4);
+
+ spin_unlock_irqrestore(&buffer_lock, flags);
return length;
}
--
Stefan Richter
-=====-==--= =--- ===--
http://arcgraph.de/sr/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-08-28 13:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-28 13:20 [PATCH] firewire: core: reduce stack usage in bus reset tasklet Stefan Richter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®