[PATCH] powerpc: perf_counters: Reduce stack usage of power_check_constraints

Michael Ellerman michael at ellerman.id.au
Thu Sep 10 17:03:18 EST 2009


On Thu, 2009-09-10 at 16:28 +1000, Paul Mackerras wrote:
> Michael Ellerman reported stack-frame size warnings being produced
> for power_check_constraints(), which uses an 8*8 array of u64 and
> two 8*8 arrays of unsigned long, which are currently allocated on the
> stack, along with some other smaller variables.  These arrays come
> to 1.5kB on 64-bit or 1kB on 32-bit, which is a bit too much for the
> stack.
> 
> This fixes the problem by putting these arrays in the existing
> per-cpu cpu_hw_counters struct.  This is OK because two of the call
> sites have interrupts disabled already; for the third call site we
> use get_cpu_var, which disables preemption, so we know we won't
> get a context switch while we're in power_check_constraints().
> Note that power_check_constraints() can be called during context
> switch but is not called from interrupts.

Yep, it does indeed fix the build warning :D

cheers
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20090910/e8c67417/attachment.pgp>


More information about the Linuxppc-dev mailing list